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.

refactor(sdk): the package root stops being where modules go to be lost

esengineb80a6b923052
diff --git a/build-tools/tasks/native.js b/build-tools/tasks/native.js
index f116b6c27..cb7b8adb3 100644
--- a/build-tools/tasks/native.js
+++ b/build-tools/tasks/native.js
@@ -98,7 +98,7 @@ async function generateNativeFunctionBindings(rootDir, genDir, python) {
await runCommand(python, [
eht,
'--native-functions', ...ENGINE_BINDING_HEADERS.map(abs),
- '--native-functions-ts', path.join(rootDir, 'sdk', 'src', 'ecs', 'nativeEngineApi.generated.ts'),
+ '--native-functions-ts', path.join(rootDir, 'sdk', 'src', 'ecs', 'bridge', 'nativeEngineApi.generated.ts'),
'--native-shim', 'esn_shim.hpp',
], { cwd: rootDir });
return out;
diff --git a/build-tools/tasks/sync.js b/build-tools/tasks/sync.js
index b881fa5b8..7e8d8274b 100644
--- a/build-tools/tasks/sync.js
+++ b/build-tools/tasks/sync.js
@@ -60,7 +60,7 @@ async function writeWasmManifest(rootDir) {
(v) => existsSync(path.join(rootDir, 'build/wasm', v)),
);
- const genPath = path.join(config.paths.sdk, 'src/component.generated.ts');
+ const genPath = path.join(config.paths.sdk, 'src/ecs/component.generated.ts');
const gen = await readFile(genPath, 'utf8');
const m = /ABI_LAYOUT_HASH\s*=\s*['"]([0-9a-f]+)['"]/i.exec(gen);
const abiHash = m ? m[1] : 'unknown';
diff --git a/sdk/src/ai/bt/BehaviorTreeAgent.ts b/sdk/src/ai/bt/BehaviorTreeAgent.ts
index 99cc0bf6f..5332b5aac 100644
--- a/sdk/src/ai/bt/BehaviorTreeAgent.ts
+++ b/sdk/src/ai/bt/BehaviorTreeAgent.ts
@@ -9,7 +9,7 @@
* pure TS, mirroring StateMachineAgent.
*/
-import { defineComponent } from '../../component';
+import { defineComponent } from '../../ecs/component';
import { isUuidRef } from '../../asset/AssetRegistry';
import type { BtDefinition } from './types';
diff --git a/sdk/src/ai/bt/BtPlugin.ts b/sdk/src/ai/bt/BtPlugin.ts
index ce013ce9f..d8d213ec7 100644
--- a/sdk/src/ai/bt/BtPlugin.ts
+++ b/sdk/src/ai/bt/BtPlugin.ts
@@ -13,13 +13,13 @@
import type { App, Plugin } from '../../app';
import type { Entity } from '../../types';
-import type { World } from '../../world';
-import { defineSystem, Schedule, GetWorld } from '../../system';
-import { Res, Time, type TimeData } from '../../resource';
-import { defineResource } from '../../resource';
-import { Commands, type CommandsInstance } from '../../commands';
+import type { World } from '../../ecs/world';
+import { defineSystem, Schedule, GetWorld } from '../../ecs/system';
+import { Res, Time, type TimeData } from '../../ecs/resource';
+import { defineResource } from '../../ecs/resource';
+import { Commands, type CommandsInstance } from '../../ecs/commands';
import { playModeOnly } from '../../env';
-import type { AnyComponentDef, ComponentData } from '../../component';
+import type { AnyComponentDef, ComponentData } from '../../ecs/component';
import { Assets } from '../../asset/AssetPlugin';
import { resolveAssetKey } from '../../asset/resolveAssetKey';
import { Blackboard } from '../fsm/Blackboard';
diff --git a/sdk/src/ai/fsm/AiContext.ts b/sdk/src/ai/fsm/AiContext.ts
index a8147f5e5..67770b7b8 100644
--- a/sdk/src/ai/fsm/AiContext.ts
+++ b/sdk/src/ai/fsm/AiContext.ts
@@ -12,9 +12,9 @@
*/
import type { Entity } from '../../types';
-import type { World } from '../../world';
-import type { CommandsInstance } from '../../commands';
-import type { AnyComponentDef, ComponentData } from '../../component';
+import type { World } from '../../ecs/world';
+import type { CommandsInstance } from '../../ecs/commands';
+import type { AnyComponentDef, ComponentData } from '../../ecs/component';
import type { Blackboard } from './Blackboard';
import { AiRegistry, type AiAction, type AiCondition } from './registry';
diff --git a/sdk/src/ai/fsm/FsmPlugin.ts b/sdk/src/ai/fsm/FsmPlugin.ts
index 928399653..0fbb97f4c 100644
--- a/sdk/src/ai/fsm/FsmPlugin.ts
+++ b/sdk/src/ai/fsm/FsmPlugin.ts
@@ -13,13 +13,13 @@
import type { App, Plugin } from '../../app';
import type { Entity } from '../../types';
-import type { World } from '../../world';
-import { defineSystem, Schedule, GetWorld } from '../../system';
-import { Res, Time, type TimeData } from '../../resource';
-import { defineResource } from '../../resource';
-import { Commands, type CommandsInstance } from '../../commands';
+import type { World } from '../../ecs/world';
+import { defineSystem, Schedule, GetWorld } from '../../ecs/system';
+import { Res, Time, type TimeData } from '../../ecs/resource';
+import { defineResource } from '../../ecs/resource';
+import { Commands, type CommandsInstance } from '../../ecs/commands';
import { playModeOnly } from '../../env';
-import type { AnyComponentDef, ComponentData } from '../../component';
+import type { AnyComponentDef, ComponentData } from '../../ecs/component';
import { Assets } from '../../asset/AssetPlugin';
import { resolveAssetKey } from '../../asset/resolveAssetKey';
import { Blackboard } from './Blackboard';
diff --git a/sdk/src/ai/fsm/StateMachineAgent.ts b/sdk/src/ai/fsm/StateMachineAgent.ts
index 5f03b43ca..ebc3f7a69 100644
--- a/sdk/src/ai/fsm/StateMachineAgent.ts
+++ b/sdk/src/ai/fsm/StateMachineAgent.ts
@@ -9,7 +9,7 @@
* to stay clear of the UI-owned `StateMachine` component.
*/
-import { defineComponent } from '../../component';
+import { defineComponent } from '../../ecs/component';
import { isUuidRef } from '../../asset/AssetRegistry';
import type { FsmDefinition } from './types';
import { compileFsm, type CompiledFsm } from './FsmRunner';
diff --git a/sdk/src/ai/nav/NavAgent.ts b/sdk/src/ai/nav/NavAgent.ts
index 3a1e80312..9cc9efdaa 100644
--- a/sdk/src/ai/nav/NavAgent.ts
+++ b/sdk/src/ai/nav/NavAgent.ts
@@ -11,8 +11,8 @@
* with the `*Agent` suffix to stay clear of the UI-owned `StateMachine`.
*/
-import { defineComponent } from '../../component';
-import type { World } from '../../world';
+import { defineComponent } from '../../ecs/component';
+import type { World } from '../../ecs/world';
import type { Entity, Vec2 } from '../../types';
export interface NavAgentData {
diff --git a/sdk/src/ai/nav/NavPlugin.ts b/sdk/src/ai/nav/NavPlugin.ts
index 8b1ba9453..4f0f6695a 100644
--- a/sdk/src/ai/nav/NavPlugin.ts
+++ b/sdk/src/ai/nav/NavPlugin.ts
@@ -14,13 +14,13 @@
import type { App, Plugin } from '../../app';
import type { Entity } from '../../types';
-import { defineSystem, Schedule, GetWorld } from '../../system';
-import { Res, Time, type TimeData } from '../../resource';
+import { defineSystem, Schedule, GetWorld } from '../../ecs/system';
+import { Res, Time, type TimeData } from '../../ecs/resource';
import {
Transform,
type AnyComponentDef,
type ComponentData,
-} from '../../component';
+} from '../../ecs/component';
import { playModeOnly } from '../../env';
import { Navigation, Nav } from './Navigation';
import { NavAgent } from './NavAgent';
diff --git a/sdk/src/ai/nav/Navigation.ts b/sdk/src/ai/nav/Navigation.ts
index 9d3e316e4..19136ede1 100644
--- a/sdk/src/ai/nav/Navigation.ts
+++ b/sdk/src/ai/nav/Navigation.ts
@@ -8,7 +8,7 @@
* `app.getResource(Nav)`) to swap the grid or query a path directly.
*/
-import { defineResource } from '../../resource';
+import { defineResource } from '../../ecs/resource';
import type { Vec2 } from '../../types';
import { NavGrid } from './NavGrid';
import { findPath, pathToWorld, type PathfindOptions } from './pathfind';
diff --git a/sdk/src/ai/perception/PerceptionPlugin.ts b/sdk/src/ai/perception/PerceptionPlugin.ts
index 784e4e5fa..1b697aa70 100644
--- a/sdk/src/ai/perception/PerceptionPlugin.ts
+++ b/sdk/src/ai/perception/PerceptionPlugin.ts
@@ -13,10 +13,10 @@
import type { App, Plugin } from '../../app';
import type { Entity } from '../../types';
-import { defineSystem, Schedule, GetWorld } from '../../system';
+import { defineSystem, Schedule, GetWorld } from '../../ecs/system';
import { playModeOnly } from '../../env';
-import { Transform } from '../../component';
-import type { AnyComponentDef, ComponentData } from '../../component';
+import { Transform } from '../../ecs/component';
+import type { AnyComponentDef, ComponentData } from '../../ecs/component';
import { Physics, type PhysicsAPI } from '../../physics';
import { senseTarget, facingFromQuat } from './sense';
import { Perceiver, Perception, PerceptionTarget, type PerceptionData } from './components';
diff --git a/sdk/src/ai/perception/components.ts b/sdk/src/ai/perception/components.ts
index b631576cd..56b200867 100644
--- a/sdk/src/ai/perception/components.ts
+++ b/sdk/src/ai/perception/components.ts
@@ -8,7 +8,7 @@
* perception flows through ECS data, not a side channel.
*/
-import { defineComponent, defineTag } from '../../component';
+import { defineComponent, defineTag } from '../../ecs/component';
export interface PerceiverData {
/** Sight range in world pixels. */
diff --git a/sdk/src/animation/AnimationPlugin.ts b/sdk/src/animation/AnimationPlugin.ts
index 758b3bf2a..2679c4588 100644
--- a/sdk/src/animation/AnimationPlugin.ts
+++ b/sdk/src/animation/AnimationPlugin.ts
@@ -6,12 +6,12 @@
*/
import type { App, Plugin } from '../app';
-import { defineSystem, Schedule } from '../system';
-import { Res } from '../resource';
-import { Time, type TimeData } from '../resource';
+import { defineSystem, Schedule } from '../ecs/system';
+import { Res } from '../ecs/resource';
+import { Time, type TimeData } from '../ecs/resource';
import type { Entity } from '../types';
import type { CppRegistry } from '../wasm';
-import { engineApi } from '../ecs/engineApi';
+import { engineApi } from '../ecs/bridge/engineApi';
import { log } from '../logger';
import type { AnimCore } from './Tween';
import { Tween, TweenAPI } from './Tween';
@@ -20,7 +20,7 @@ import { AnimatorController, AnimatorControllerAPI } from './Animator';
import { Assets } from '../asset/AssetPlugin';
import { resolveAssetKey } from '../asset/resolveAssetKey';
import { playModeOnly } from '../env';
-import { SystemLabel } from '../systemLabels';
+import { SystemLabel } from '../ecs/systemLabels';
export class AnimationPlugin implements Plugin {
name = 'animation';
diff --git a/sdk/src/animation/Animator.ts b/sdk/src/animation/Animator.ts
index f5a0feba4..5939b0ef1 100644
--- a/sdk/src/animation/Animator.ts
+++ b/sdk/src/animation/Animator.ts
@@ -16,11 +16,11 @@
* World, no side effects — so it is fully unit-testable.
*/
-import { defineComponent, type ComponentDef } from '../component';
-import { defineResource } from '../resource';
+import { defineComponent, type ComponentDef } from '../ecs/component';
+import { defineResource } from '../ecs/resource';
import { isUuidRef } from '../asset/AssetRegistry';
import type { Entity } from '../types';
-import type { World } from '../world';
+import type { World } from '../ecs/world';
import { SpriteAnimator, type SpriteAnimatorData } from './SpriteAnimator';
// =============================================================================
diff --git a/sdk/src/animation/SpriteAnimator.ts b/sdk/src/animation/SpriteAnimator.ts
index 316667b90..6c8879d6b 100644
--- a/sdk/src/animation/SpriteAnimator.ts
+++ b/sdk/src/animation/SpriteAnimator.ts
@@ -5,11 +5,11 @@
* @brief Sprite frame animation component and system (pure TypeScript)
*/
-import { defineComponent, type ComponentDef } from '../component';
-import { defineResource } from '../resource';
+import { defineComponent, type ComponentDef } from '../ecs/component';
+import { defineResource } from '../ecs/resource';
import type { Entity, TextureHandle } from '../types';
-import type { World } from '../world';
-import { Sprite, type SpriteData } from '../component';
+import type { World } from '../ecs/world';
+import { Sprite, type SpriteData } from '../ecs/component';
// =============================================================================
// Sprite Animation Clip
diff --git a/sdk/src/animation/Tween.ts b/sdk/src/animation/Tween.ts
index 53017b529..721c6f160 100644
--- a/sdk/src/animation/Tween.ts
+++ b/sdk/src/animation/Tween.ts
@@ -11,8 +11,8 @@
import type { Entity } from '../types';
import type { CppRegistry } from '../wasm';
-import type { EngineApi } from '../ecs/engineApi';
-import { defineResource } from '../resource';
+import type { EngineApi } from '../ecs/bridge/engineApi';
+import { defineResource } from '../ecs/resource';
import { EasingType } from './Easing';
import { LoopMode, TweenState, type TweenOptions } from './TweenTypes';
import { ValueTweenManager, ValueTweenHandle } from './ValueTween';
diff --git a/sdk/src/app.ts b/sdk/src/app.ts
index 7e44d27d1..f84ae4a1a 100644
--- a/sdk/src/app.ts
+++ b/sdk/src/app.ts
@@ -5,26 +5,26 @@
* @brief Application builder and web platform integration
*/
-import { World } from './world';
-import { Schedule, SystemDef, SystemRunner, SystemSet, type RunCondition } from './system';
-import { ResourceStorage, Time, TimeData, type ResourceDef } from './resource';
-import { EventRegistry, type EventDef } from './event';
+import { World } from './ecs/world';
+import { Schedule, SystemDef, SystemRunner, SystemSet, type RunCondition } from './ecs/system';
+import { ResourceStorage, Time, TimeData, type ResourceDef } from './ecs/resource';
+import { EventRegistry, type EventDef } from './ecs/event';
import type { ESEngineModule, CppRegistry } from './wasm';
-import type { BridgeConnectOptions } from './ecs/BuiltinBridge';
+import type { BridgeConnectOptions } from './ecs/bridge/BuiltinBridge';
import { UICameraInfo } from './ui/core/ui-camera-info';
-import { inputPlugin, Input } from './input';
+import { inputPlugin, Input } from './input/input';
import { assetPlugin } from './asset';
import { prefabsPlugin } from './prefabServer';
-import { setWasmErrorHandler } from './wasmError';
+import { setWasmErrorHandler } from './wasm/wasmError';
import { corePlugin, DEFAULT_UI_CAMERA_INFO } from './corePlugin';
import { platformNow } from './platform';
-import { RenderPipeline } from './renderPipeline';
+import { RenderPipeline } from './render/renderPipeline';
import type { SceneConfig } from './sceneManager';
import { SceneManager } from './sceneManager';
import { sceneManagerPlugin } from './scenePlugin';
-import { getDefaultContext } from './context';
+import { getDefaultContext } from './ecs/context';
import { setLinearColorSpace } from './env';
-import { seedEngineComponents } from './component';
+import { seedEngineComponents } from './ecs/component';
import { cameraPlugin } from './camera/CameraPlugin';
import { ScreenScaling, SCREEN_FIT_OFF, type ScreenScalingData } from './camera/ScreenScaling';
import { PhysicsRuntime } from './physics/PhysicsRuntime';
diff --git a/sdk/src/asset/AssetPlugin.ts b/sdk/src/asset/AssetPlugin.ts
index e59d0c8ce..9ca265a41 100644
--- a/sdk/src/asset/AssetPlugin.ts
+++ b/sdk/src/asset/AssetPlugin.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from '../app';
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
import { Assets as AssetsClass } from './Assets';
import { HttpBackend } from './Backend';
import { transcoderFromModule, type BasisWasmModule } from './basisTranscoder';
diff --git a/sdk/src/asset/Assets.ts b/sdk/src/asset/Assets.ts
index 3cd9324bf..3515cdfc2 100644
--- a/sdk/src/asset/Assets.ts
+++ b/sdk/src/asset/Assets.ts
@@ -15,7 +15,7 @@ import type {
import { AsyncCache } from './AsyncCache';
import type { ESEngineModule } from '../wasm';
import type { CppResourceManager } from '../wasm';
-import { requireResourceManager, getResourceManager, evictTextureDimensions } from '../resourceManager';
+import { requireResourceManager, getResourceManager, evictTextureDimensions } from '../wasm/resourceManager';
import type { TextureImportSettings, TextureImportSettingsResolver } from './loaders/TextureLoader';
import { TextureLoader, textureResidencyKey } from './loaders/TextureLoader';
import { SpineAssetLoader } from './loaders/SpineAssetLoader';
@@ -32,7 +32,7 @@ import { AnimatorControllerAssetLoader } from './loaders/AnimatorControllerAsset
import { BtAssetLoader } from './loaders/BtAssetLoader';
import { LocaleAssetLoader } from './loaders/LocaleAssetLoader';
import type { SpineModuleController } from '../spine/SpineController';
-import { getComponentDefaults } from '../component';
+import { getComponentDefaults } from '../ecs/component';
import { getComponentAssetFieldDescriptors } from '../scene';
import { discoverSceneAssets } from './discoverAssets';
import { fetchDecodePixels } from './imageDecode';
diff --git a/sdk/src/asset/compressed.ts b/sdk/src/asset/compressed.ts
index cdce90da7..e55f90fbd 100644
--- a/sdk/src/asset/compressed.ts
+++ b/sdk/src/asset/compressed.ts
@@ -15,7 +15,7 @@
* entry backs the non-WebGL2 fallback path instead.
*/
import type { ESEngineModule } from '../wasm';
-import { requireResourceManager } from '../resourceManager';
+import { requireResourceManager } from '../wasm/resourceManager';
import { glWrapMode } from './glTexParams';
// =============================================================================
diff --git a/sdk/src/asset/discoverAssets.ts b/sdk/src/asset/discoverAssets.ts
index a50647708..40e44f2f5 100644
--- a/sdk/src/asset/discoverAssets.ts
+++ b/sdk/src/asset/discoverAssets.ts
@@ -22,7 +22,7 @@
* store paths directly.
*/
-import { getComponent } from '../component';
+import { getComponent } from '../ecs/component';
import type { SceneData, AssetFieldType } from '../scene';
export interface SpineAssetRef {
diff --git a/sdk/src/asset/loaders/FontAssetLoader.ts b/sdk/src/asset/loaders/FontAssetLoader.ts
index d186816cd..56952db9d 100644
--- a/sdk/src/asset/loaders/FontAssetLoader.ts
+++ b/sdk/src/asset/loaders/FontAssetLoader.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { AssetLoader, LoadContext, FontResult } from '../AssetLoader';
-import { requireResourceManager } from '../../resourceManager';
+import { requireResourceManager } from '../../wasm/resourceManager';
import { getAssetTypeEntry } from '../../assetTypes';
import { getPlatform } from '../../platform/base';
import {
diff --git a/sdk/src/asset/loaders/MaterialAssetLoader.ts b/sdk/src/asset/loaders/MaterialAssetLoader.ts
index e94b1df9a..7e2365fe8 100644
--- a/sdk/src/asset/loaders/MaterialAssetLoader.ts
+++ b/sdk/src/asset/loaders/MaterialAssetLoader.ts
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { AssetLoader, LoadContext, MaterialResult } from '../AssetLoader';
-import type { MaterialAssetData, ShaderHandle } from '../../material';
-import { Material } from '../../material';
-import { builtinShaderTemplate } from '../../builtinShaders';
+import type { MaterialAssetData, ShaderHandle } from '../../render/material';
+import { Material } from '../../render/material';
+import { builtinShaderTemplate } from '../../render/builtinShaders';
import { AsyncCache } from '../AsyncCache';
import { log } from '../../logger';
diff --git a/sdk/src/asset/loaders/SpineAssetLoader.ts b/sdk/src/asset/loaders/SpineAssetLoader.ts
index e3c415e62..dfeef827a 100644
--- a/sdk/src/asset/loaders/SpineAssetLoader.ts
+++ b/sdk/src/asset/loaders/SpineAssetLoader.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { AssetLoader, LoadContext, SpineResult } from '../AssetLoader';
-import { requireResourceManager } from '../../resourceManager';
+import { requireResourceManager } from '../../wasm/resourceManager';
import { getAssetTypeEntry } from '../../assetTypes';
import type { ESEngineModule } from '../../wasm';
import type { SpineModuleController } from '../../spine/SpineController';
diff --git a/sdk/src/asset/loaders/TextureLoader.ts b/sdk/src/asset/loaders/TextureLoader.ts
index dfb48bc37..9938ebeab 100644
--- a/sdk/src/asset/loaders/TextureLoader.ts
+++ b/sdk/src/asset/loaders/TextureLoader.ts
@@ -5,12 +5,12 @@ import { linearColorSpace } from '../../env';
import { platformCreateCanvas, platformCreateImage } from '../../platform/base';
import type { PlatformCanvas, PlatformCanvas2DContext, PlatformImage } from '../../platform/types';
import { decodeImageBitmap } from '../imageDecode';
-import { requireResourceManager } from '../../resourceManager';
+import { requireResourceManager } from '../../wasm/resourceManager';
import type { ESEngineModule } from '../../wasm';
-import { withMalloc } from '../../wasmScratch';
+import { withMalloc } from '../../wasm/wasmScratch';
import { isKtx2, isKtx2Path, loadCompressedTexture, type BasisTranscoder } from '../compressed';
import { glWrapMode } from '../glTexParams';
-import { createTextureFromPixels, type TextureParams } from '../../runtimeAssets';
+import { createTextureFromPixels, type TextureParams } from '../../runtime/runtimeAssets';
/**
* Decode a texture ref to raw RGBA pixels on the current platform. Set by a
diff --git a/sdk/src/audio/Audio.ts b/sdk/src/audio/Audio.ts
index 79d94880d..c4bc612c6 100644
--- a/sdk/src/audio/Audio.ts
+++ b/sdk/src/audio/Audio.ts
@@ -3,7 +3,7 @@
import type { PlatformAudioBackend, AudioBufferHandle, AudioHandle, PlayConfig } from './PlatformAudioBackend';
import type { AudioMixer, BusDuckRule } from './AudioMixer';
import type { BusEffectDef } from './BusEffects';
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
import { RuntimeConfig } from '../defaults';
import { log } from '../logger';
diff --git a/sdk/src/audio/AudioComponents.ts b/sdk/src/audio/AudioComponents.ts
index ff57ba0e1..43760fbe5 100644
--- a/sdk/src/audio/AudioComponents.ts
+++ b/sdk/src/audio/AudioComponents.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { defineComponent } from '../component';
+import { defineComponent } from '../ecs/component';
import { AttenuationModel } from './SpatialAudio';
export interface AudioSourceData {
diff --git a/sdk/src/audio/AudioPlugin.ts b/sdk/src/audio/AudioPlugin.ts
index 2210bd79a..626f51a4d 100644
--- a/sdk/src/audio/AudioPlugin.ts
+++ b/sdk/src/audio/AudioPlugin.ts
@@ -2,11 +2,11 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from '../app';
import type { Entity } from '../types';
-import { defineSystem, Schedule } from '../system';
-import { Res, Time, type TimeData } from '../resource';
+import { defineSystem, Schedule } from '../ecs/system';
+import { Res, Time, type TimeData } from '../ecs/resource';
import { Audio, AudioAPI } from './Audio';
import { AudioSource, AudioListener, type AudioSourceData, type AudioListenerData } from './AudioComponents';
-import { WorldTransform, type WorldTransformData } from '../component';
+import { WorldTransform, type WorldTransformData } from '../ecs/component';
import { platformCreateAudioBackend, platformOnMemoryWarning } from '../platform/base';
import { calculateAttenuation, calculatePanning, type SpatialAudioConfig, AttenuationModel } from './SpatialAudio';
import type { AudioHandle } from './PlatformAudioBackend';
diff --git a/sdk/src/behavior.ts b/sdk/src/behavior.ts
index dc0e94861..17439113f 100644
--- a/sdk/src/behavior.ts
+++ b/sdk/src/behavior.ts
@@ -17,13 +17,13 @@ import {
type ComponentData,
type ComponentDef,
type ComponentMetadata,
-} from './component';
-import { Schedule, defineSystem, addSystemToSchedule, GetWorld } from './system';
-import { Query, Mut } from './query';
-import { Res, Time, type TimeData } from './resource';
-import { Commands, type CommandsInstance } from './commands';
-import { Input, type InputState } from './input';
-import type { World } from './world';
+} from './ecs/component';
+import { Schedule, defineSystem, addSystemToSchedule, GetWorld } from './ecs/system';
+import { Query, Mut } from './ecs/query';
+import { Res, Time, type TimeData } from './ecs/resource';
+import { Commands, type CommandsInstance } from './ecs/commands';
+import { Input, type InputState } from './input/input';
+import type { World } from './ecs/world';
/**
* The per-entity handle passed to a behavior's lifecycle hooks. `self` is the
diff --git a/sdk/src/camera/Camera.ts b/sdk/src/camera/Camera.ts
index f19aa2485..c9b4aac45 100644
--- a/sdk/src/camera/Camera.ts
+++ b/sdk/src/camera/Camera.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App } from '../app';
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
import { UICameraInfo, type UICameraData } from '../ui/core/ui-camera-info';
import { screenToWorld, worldToScreen, createInvVPCache } from '../ui/util/math';
diff --git a/sdk/src/camera/CameraDirector.ts b/sdk/src/camera/CameraDirector.ts
index 33a485b4f..e58f439f3 100644
--- a/sdk/src/camera/CameraDirector.ts
+++ b/sdk/src/camera/CameraDirector.ts
@@ -11,7 +11,7 @@
* director is the runtime that selects + transitions between them.
*/
import type { App } from '../app';
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
import { applyEasing, EasingType } from '../animation/Easing';
import type { CameraPOV } from './CameraPlugin';
diff --git a/sdk/src/camera/CameraPlugin.ts b/sdk/src/camera/CameraPlugin.ts
index 935c295b8..e1d15a708 100644
--- a/sdk/src/camera/CameraPlugin.ts
+++ b/sdk/src/camera/CameraPlugin.ts
@@ -6,22 +6,22 @@
*/
import type { App, Plugin } from '../app';
-import type { SystemDef } from '../system';
-import { Schedule, defineSystem } from '../system';
-import { Res, Time, type TimeData } from '../resource';
+import type { SystemDef } from '../ecs/system';
+import { Schedule, defineSystem } from '../ecs/system';
+import { Res, Time, type TimeData } from '../ecs/resource';
import { playModeOnly } from '../env';
import { followUpdate } from './FollowTarget';
import type { ESEngineModule, CppRegistry } from '../wasm';
-import type { World } from '../world';
+import type { World } from '../ecs/world';
import type { Entity } from '../types';
import { UICameraInfo } from '../ui/core/ui-camera-info';
-import { ProjectionType, SceneOwner, ClearFlags } from '../component';
+import { ProjectionType, SceneOwner, ClearFlags } from '../ecs/component';
import { uiLayoutRect, computeEffectiveOrthoSize, EDITOR_VIEW_ENTITY, type CanvasScale } from './uiLayoutRect';
import { EditorView, DEFAULT_EDITOR_VIEW, type EditorViewData } from './EditorView';
import { ScreenScaling, DEFAULT_SCREEN_SCALING, SCREEN_FIT_OFF } from './ScreenScaling';
import { CameraDirector, createDirectorState, resolveMainPOV } from './CameraDirector';
-import { RenderPipeline } from '../renderPipeline';
-import { Renderer } from '../renderer';
+import { RenderPipeline } from '../render/renderPipeline';
+import { Renderer } from '../render/renderer';
import { platformNow, platformDevicePixelRatio } from '../platform';
import { SceneManager } from '../sceneManager';
import { ortho, perspective, invertViewZ, multiply, IDENTITY } from '../math/mat4';
diff --git a/sdk/src/camera/EditorGrid.ts b/sdk/src/camera/EditorGrid.ts
index 5a11fafa6..3af72401d 100644
--- a/sdk/src/camera/EditorGrid.ts
+++ b/sdk/src/camera/EditorGrid.ts
@@ -17,7 +17,7 @@
* x=0 / y=0 axis lines use the axis colors (red X / green Y) so the origin reads
* at a glance.
*/
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
export type GridColor = [number, number, number, number];
diff --git a/sdk/src/camera/EditorView.ts b/sdk/src/camera/EditorView.ts
index fd4e03d09..b502b5bf4 100644
--- a/sdk/src/camera/EditorView.ts
+++ b/sdk/src/camera/EditorView.ts
@@ -16,7 +16,7 @@
* cameras (see CameraPlugin) — there is one source of view-projection math; only
* the camera *configuration* (full-frame, raw orthoSize) differs.
*/
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
export interface EditorViewData {
/** When true, the framebuffer + screen<->world use this view, not scene cameras. */
diff --git a/sdk/src/camera/FollowTarget.ts b/sdk/src/camera/FollowTarget.ts
index c901145e1..e4f88965c 100644
--- a/sdk/src/camera/FollowTarget.ts
+++ b/sdk/src/camera/FollowTarget.ts
@@ -10,8 +10,8 @@
* (the ECS-native place), so the director simply blends already-followed
* POVs. Runs in play mode only.
*/
-import { defineComponent, Transform } from '../component';
-import type { World } from '../world';
+import { defineComponent, Transform } from '../ecs/component';
+import type { World } from '../ecs/world';
import type { Entity } from '../types';
export interface FollowTargetData {
diff --git a/sdk/src/camera/ScreenScaling.ts b/sdk/src/camera/ScreenScaling.ts
index 1f444702a..41f594d20 100644
--- a/sdk/src/camera/ScreenScaling.ts
+++ b/sdk/src/camera/ScreenScaling.ts
@@ -18,7 +18,7 @@
* Installed by every runtime; the shipped game / play realm / editor set it from
* the project config (design resolution + fit). Read by CameraPlugin.resolveCameras.
*/
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
/** `scaleMode` sentinel: no camera fit — the camera uses its own orthoSize (default). */
export const SCREEN_FIT_OFF = -1;
diff --git a/sdk/src/camera/editorGridRenderer.ts b/sdk/src/camera/editorGridRenderer.ts
index acf01851d..816e98c9c 100644
--- a/sdk/src/camera/editorGridRenderer.ts
+++ b/sdk/src/camera/editorGridRenderer.ts
@@ -26,11 +26,11 @@
* editor and the headless render host (pixel verification) get the grid for free.
*/
import type { App } from '../app';
-import { Draw } from '../draw';
-import { Geometry, type GeometryHandle } from '../geometry';
-import { Material, type MaterialHandle } from '../material';
-import { BlendMode } from '../blend';
-import { registerPreSceneDrawCallback } from '../customDraw';
+import { Draw } from '../render/draw';
+import { Geometry, type GeometryHandle } from '../render/geometry';
+import { Material, type MaterialHandle } from '../render/material';
+import { BlendMode } from '../render/blend';
+import { registerPreSceneDrawCallback } from '../render/customDraw';
import { EditorView } from './EditorView';
import { EditorGrid, DEFAULT_EDITOR_GRID } from './EditorGrid';
diff --git a/sdk/src/camera/uiLayoutRect.ts b/sdk/src/camera/uiLayoutRect.ts
index 3a40942b3..3ca7e075a 100644
--- a/sdk/src/camera/uiLayoutRect.ts
+++ b/sdk/src/camera/uiLayoutRect.ts
@@ -8,7 +8,7 @@
* isolation like viewportMath. CameraPlugin builds on top of it.
*/
-import { CanvasScaleMode } from '../wasm.generated';
+import { CanvasScaleMode } from '../wasm/wasm.generated';
/**
* Half-height (world units) of the visible area after fitting a design resolution
diff --git a/sdk/src/core-content.ts b/sdk/src/core-content.ts
index cf729acfc..533cab584 100644
--- a/sdk/src/core-content.ts
+++ b/sdk/src/core-content.ts
@@ -97,7 +97,7 @@ export {
// Resource budget (VRAM)
// =============================================================================
-export { setTextureBudget, getResourceStats, trimTextureCache, type ResourceStats } from './resourceManager';
+export { setTextureBudget, getResourceStats, trimTextureCache, type ResourceStats } from './wasm/resourceManager';
// =============================================================================
// Scene
@@ -239,7 +239,7 @@ export {
type RuntimeAssetSource,
type LoadRuntimeSceneOptions,
type RuntimeInitConfig,
-} from './runtimeLoader';
+} from './runtime/runtimeLoader';
// The packaged-realm assembly (WeChat, native) + the game.config.json contract the
// export pipeline writes and every runtime reads.
@@ -252,7 +252,7 @@ export {
type PackagedAssetIndex,
type PackagedAssetSourceOptions,
type PackagedGameConfig,
-} from './packagedRuntime';
+} from './runtime/packagedRuntime';
// =============================================================================
// Preview
@@ -442,7 +442,7 @@ export {
Meshes2D,
Mesh2DPlugin,
mesh2dPlugin,
-} from './mesh2d';
+} from './render/mesh2d';
// =============================================================================
// Tilemap
diff --git a/sdk/src/core-render.ts b/sdk/src/core-render.ts
index b07091a21..e1a69b850 100644
--- a/sdk/src/core-render.ts
+++ b/sdk/src/core-render.ts
@@ -15,25 +15,25 @@
// Filters
// =============================================================================
-export { Filters } from './filters';
+export { Filters } from './render/filters';
export {
SpriteFilter,
type OutlineFilterOptions,
type DropShadowFilterOptions,
-} from './spriteFilter';
+} from './render/spriteFilter';
// =============================================================================
// Graphics
// =============================================================================
-export { Graphics } from './graphics';
+export { Graphics } from './render/graphics';
// =============================================================================
// Texture
// =============================================================================
-export { TextureFilter, TextureWrap, setTextureFilter, setTextureWrap, setTextureParams, setTextureSliceBorder } from './textureParams';
+export { TextureFilter, TextureWrap, setTextureFilter, setTextureWrap, setTextureParams, setTextureSliceBorder } from './render/textureParams';
// =============================================================================
// Camera
@@ -64,7 +64,7 @@ export {
BlendMode,
shutdownDrawAPI,
type DrawAPI,
-} from './draw';
+} from './render/draw';
// =============================================================================
// Material API
@@ -83,13 +83,13 @@ export {
type MaterialAssetData,
type UniformValue,
type TextureRef,
-} from './material';
+} from './render/material';
export {
BUILTIN_SHADER_TEMPLATES,
builtinShaderTemplate,
type BuiltinShaderTemplate,
-} from './builtinShaders';
+} from './render/builtinShaders';
export {
compileMaterialGraph,
@@ -107,7 +107,7 @@ export {
type NodeSpec,
type NodePort,
type NodeParamSpec,
-} from './materialGraph';
+} from './render/materialGraph';
// =============================================================================
// Geometry API
@@ -120,7 +120,7 @@ export {
type GeometryHandle,
type GeometryOptions,
type VertexAttributeDescriptor,
-} from './geometry';
+} from './render/geometry';
// =============================================================================
// PostProcess API
@@ -148,14 +148,14 @@ export {
shutdownRendererAPI,
type RenderTargetHandle,
type RenderStats,
-} from './renderer';
+} from './render/renderer';
export {
FlushReason,
RenderType,
type DrawCallInfo,
type FrameCaptureData,
-} from './frameCapture';
+} from './render/frameCapture';
// =============================================================================
// RenderTexture API
@@ -165,7 +165,7 @@ export {
RenderTexture,
type RenderTextureHandle,
type RenderTextureOptions,
-} from './renderTexture';
+} from './render/renderTexture';
// =============================================================================
// Render Pipeline
@@ -176,7 +176,7 @@ export {
type Viewport,
type RenderParams,
type CameraRenderParams,
-} from './renderPipeline';
+} from './render/renderPipeline';
// =============================================================================
// Custom Draw Callbacks
@@ -191,4 +191,4 @@ export {
unregisterPreSceneDrawCallback,
type PreSceneDrawCallback,
type PreSceneDrawInfo,
-} from './customDraw';
+} from './render/customDraw';
diff --git a/sdk/src/core-runtime.ts b/sdk/src/core-runtime.ts
index 7b5284c68..e25c3af54 100644
--- a/sdk/src/core-runtime.ts
+++ b/sdk/src/core-runtime.ts
@@ -143,7 +143,7 @@ export {
type ParticleForceFieldData,
PostProcessVolume,
type PostProcessVolumeData,
-} from './component';
+} from './ecs/component';
export {
RigidBody,
@@ -193,7 +193,7 @@ export {
type ResMutDescriptor,
type ResMutInstance,
type TimeData,
-} from './resource';
+} from './ecs/resource';
export { Storage } from './storage';
@@ -209,7 +209,7 @@ export {
GamepadButton,
GamepadAxis,
type TouchPoint,
-} from './input';
+} from './input/input';
export type { GamepadSnapshot } from './platform/types';
@@ -218,9 +218,9 @@ export {
inputRouter,
type InputHandler,
type Modifiers,
-} from './inputRouter';
+} from './input/inputRouter';
-export { GestureDetector, type SwipeDirection } from './gesture';
+export { GestureDetector, type SwipeDirection } from './input/gesture';
// =============================================================================
// Input Map (named actions — UE Enhanced Input / Unity Input System analog)
@@ -245,7 +245,7 @@ export {
type ActionType,
type InputMapAsset,
type ListenOptions,
-} from './inputMap';
+} from './input/inputMap';
// =============================================================================
// Query
@@ -272,7 +272,7 @@ export {
type AddedWrapper,
type ChangedWrapper,
type RemovedQueryDescriptor,
-} from './query';
+} from './ecs/query';
// =============================================================================
// Events
@@ -288,7 +288,7 @@ export {
type EventDef,
type EventWriterDescriptor,
type EventReaderDescriptor,
-} from './event';
+} from './ecs/event';
// The per-entity, string-named channel (the other half of the story above:
// `defineEvent` is the global typed bus, this is "what happened to THIS
@@ -298,7 +298,7 @@ export {
EntityEvents,
type EntityEvent,
type EntityEventHandler,
-} from './entityEvents';
+} from './ecs/entityEvents';
// Authored event → action wiring (the data form of `events.on(e, 'click', …)`).
export {
@@ -319,7 +319,7 @@ export {
CommandsInstance,
EntityCommands,
type CommandsDescriptor,
-} from './commands';
+} from './ecs/commands';
// =============================================================================
// Transactions (editor undo/redo)
@@ -330,7 +330,7 @@ export {
TransactionManager,
type TransactionOp,
type TransactionManagerOptions,
-} from './transaction';
+} from './ecs/transaction';
// =============================================================================
// System
@@ -350,7 +350,7 @@ export {
type SystemOptions,
type InferParam,
type InferParams,
-} from './system';
+} from './ecs/system';
// =============================================================================
// Behavior (per-entity scripted behavior → one ECS system)
@@ -366,11 +366,11 @@ export {
// World
// =============================================================================
-export { World } from './world';
-export { PTR_LAYOUTS } from './ptrLayouts.generated';
-export type { PtrLayout } from './ptrLayouts.generated';
-export { writePtrField, readPtrField } from './ecs/BuiltinBridge';
-export type { BuiltinBridge } from './ecs/BuiltinBridge';
+export { World } from './ecs/world';
+export { PTR_LAYOUTS } from './wasm/ptrLayouts.generated';
+export type { PtrLayout } from './wasm/ptrLayouts.generated';
+export { writePtrField, readPtrField } from './ecs/bridge/BuiltinBridge';
+export type { BuiltinBridge } from './ecs/bridge/BuiltinBridge';
// =============================================================================
// App
diff --git a/sdk/src/core-sys.ts b/sdk/src/core-sys.ts
index 07ae2bf99..c037782de 100644
--- a/sdk/src/core-sys.ts
+++ b/sdk/src/core-sys.ts
@@ -59,8 +59,8 @@ export {
// Entity Utils
// =============================================================================
-export { setEntityVisible, isEntityVisible, setEntityActive, isEntityActive } from './entityUtils';
-export { CacheBitmap, type BitmapCache } from './cacheBitmap';
+export { setEntityVisible, isEntityVisible, setEntityActive, isEntityActive } from './ecs/entityUtils';
+export { CacheBitmap, type BitmapCache } from './render/cacheBitmap';
export {
CacheAsBitmap,
getCacheForEntity,
@@ -68,8 +68,8 @@ export {
removeCacheForEntity,
clearAllCaches,
type CacheAsBitmapData,
-} from './cacheAsBitmap';
-export { pointInHitArea, type HitAreaShape } from './hitArea';
+} from './render/cacheAsBitmap';
+export { pointInHitArea, type HitAreaShape } from './input/hitArea';
// =============================================================================
// Screen
@@ -151,13 +151,13 @@ export {
export {
GLDebug,
shutdownGLDebugAPI,
-} from './glDebug';
+} from './render/glDebug';
// =============================================================================
// WASM Error Handling
// =============================================================================
-export { setWasmErrorHandler } from './wasmError';
+export { setWasmErrorHandler } from './wasm/wasmError';
// =============================================================================
// Stats
@@ -202,7 +202,7 @@ export {
type LifecycleEvent,
type LifecycleListener,
type LifecyclePluginOptions,
-} from './lifecycle';
+} from './ecs/lifecycle';
// =============================================================================
// Side Modules (physics / spine acquisition)
@@ -229,18 +229,18 @@ export {
export {
initPlayableRuntime,
type PlayableRuntimeConfig,
-} from './playableRuntime';
+} from './runtime/playableRuntime';
export {
playableCta,
hasPlayableCta,
type PlayableAdBridge,
-} from './playableCta';
+} from './runtime/playableCta';
export {
initPlayRealmRuntime,
type PlayRealmRuntimeConfig,
-} from './playRealmRuntime';
+} from './runtime/playRealmRuntime';
export {
RuntimeConfig,
@@ -257,7 +257,7 @@ export {
getResourceManager,
shutdownResourceManager,
evictTextureDimensions,
-} from './resourceManager';
+} from './wasm/resourceManager';
// =============================================================================
// Core Plugin
@@ -268,10 +268,10 @@ export { corePlugin, DEFAULT_UI_CAMERA_INFO } from './corePlugin';
// The engine entry points a plugin may call, from whichever core is present (the
// wasm module on the web, a native host's bindings on a device) — the parameter
// type the UI pick helpers take. @beta while the native host is unshipped.
-export type { EngineApi } from './ecs/engineApi';
+export type { EngineApi } from './ecs/bridge/engineApi';
// =============================================================================
// App Context
// =============================================================================
-export { AppContext, getDefaultContext, setDefaultContext, type EditorBridge } from './context';
+export { AppContext, getDefaultContext, setDefaultContext, type EditorBridge } from './ecs/context';
diff --git a/sdk/src/corePlugin.ts b/sdk/src/corePlugin.ts
index 0d9c5362b..55d7367c8 100644
--- a/sdk/src/corePlugin.ts
+++ b/sdk/src/corePlugin.ts
@@ -1,16 +1,16 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { Plugin } from './app';
-import { initResourceManager, shutdownResourceManager, setTextureBudget, trimTextureCache } from './resourceManager';
+import { initResourceManager, shutdownResourceManager, setTextureBudget, trimTextureCache } from './wasm/resourceManager';
import { platformOnMemoryWarning } from './platform/base';
import { RuntimeConfig } from './defaults';
-import { initDrawAPI, shutdownDrawAPI } from './draw';
-import { clearDrawCallbacks } from './customDraw';
-import { initMaterialAPI, shutdownMaterialAPI } from './material';
-import { initGeometryAPI, shutdownGeometryAPI } from './geometry';
+import { initDrawAPI, shutdownDrawAPI } from './render/draw';
+import { clearDrawCallbacks } from './render/customDraw';
+import { initMaterialAPI, shutdownMaterialAPI } from './render/material';
+import { initGeometryAPI, shutdownGeometryAPI } from './render/geometry';
import { initPostProcessAPI, shutdownPostProcessAPI } from './postprocess';
-import { initRendererAPI, shutdownRendererAPI } from './renderer';
-import { initGLDebugAPI, shutdownGLDebugAPI } from './glDebug';
+import { initRendererAPI, shutdownRendererAPI } from './render/renderer';
+import { initGLDebugAPI, shutdownGLDebugAPI } from './render/glDebug';
import { CameraView, CameraViewAPI } from './camera/Camera';
let offMemoryWarning: (() => void) | null = null;
diff --git a/sdk/src/defaults.ts b/sdk/src/defaults.ts
index 12eb44c77..807f07d11 100644
--- a/sdk/src/defaults.ts
+++ b/sdk/src/defaults.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { CanvasScaleMode } from './wasm.generated';
-import { COMPONENT_META } from './component.generated';
-import { getResourceManager, setTextureBudget } from './resourceManager';
+import { CanvasScaleMode } from './wasm/wasm.generated';
+import { COMPONENT_META } from './ecs/component.generated';
+import { getResourceManager, setTextureBudget } from './wasm/resourceManager';
// Values with a C++ backing read the generated metadata (Canvas ctor defaults,
// Sprite's editor_default annotation) so these constants cannot drift from the
diff --git a/sdk/src/dragonbones/DragonBonesController.ts b/sdk/src/dragonbones/DragonBonesController.ts
index 94ff6b59f..2108173d9 100644
--- a/sdk/src/dragonbones/DragonBonesController.ts
+++ b/sdk/src/dragonbones/DragonBonesController.ts
@@ -18,7 +18,7 @@
import { forEachMeshBatch, type MeshBatchVisitor } from '../skeletal/meshBatches';
import type { SkeletalBounds, SkeletalController } from '../skeletal/types';
import type { DragonBonesWasmModule, DragonBonesWrappedAPI } from './DragonBonesModuleLoader';
-import { withMalloc } from '../wasmScratch';
+import { withMalloc } from '../wasm/wasmScratch';
import { encodeUtf8 } from '../utf8';
import { log } from '../logger';
diff --git a/sdk/src/dragonbones/DragonBonesPlugin.ts b/sdk/src/dragonbones/DragonBonesPlugin.ts
index 88b71f545..60d2ca633 100644
--- a/sdk/src/dragonbones/DragonBonesPlugin.ts
+++ b/sdk/src/dragonbones/DragonBonesPlugin.ts
@@ -11,11 +11,11 @@
* that never does never touches the side module at all.
*/
import type { App, Plugin } from '../app';
-import { Schedule } from '../system';
-import type { SystemDef } from '../system';
+import { Schedule } from '../ecs/system';
+import type { SystemDef } from '../ecs/system';
import type { Entity } from '../types';
-import { defineResource, Time } from '../resource';
-import { engineApi } from '../ecs/engineApi';
+import { defineResource, Time } from '../ecs/resource';
+import { engineApi } from '../ecs/bridge/engineApi';
import { DragonBonesManager } from './DragonBonesManager';
import { DragonBonesModuleController } from './DragonBonesController';
import { wrapDragonBonesModule, type DragonBonesWasmModule } from './DragonBonesModuleLoader';
diff --git a/sdk/src/dragonbones/index.ts b/sdk/src/dragonbones/index.ts
index 7735ac125..931538dbf 100644
--- a/sdk/src/dragonbones/index.ts
+++ b/sdk/src/dragonbones/index.ts
@@ -21,4 +21,4 @@ export {
dragonBonesEntityProps,
} from './loadDragonBonesScene';
export type { DragonBonesAssetInfo } from './loadDragonBonesScene';
-export type { RuntimeAssetSource } from '../runtimeAssets';
+export type { RuntimeAssetSource } from '../runtime/runtimeAssets';
diff --git a/sdk/src/dragonbones/loadDragonBonesScene.ts b/sdk/src/dragonbones/loadDragonBonesScene.ts
index f00f17ef3..4fa790ba6 100644
--- a/sdk/src/dragonbones/loadDragonBonesScene.ts
+++ b/sdk/src/dragonbones/loadDragonBonesScene.ts
@@ -26,9 +26,9 @@ import type { Entity } from '../types';
import { getComponentSkeletalFieldDescriptor, type SceneData } from '../scene';
import { discoverSceneAssets } from '../asset/discoverAssets';
import { getAssetTypeEntry } from '../assetTypes';
-import { requireResourceManager } from '../resourceManager';
+import { requireResourceManager } from '../wasm/resourceManager';
import { log } from '../logger';
-import { createTextureFromPixels, type RuntimeAssetSource } from '../runtimeAssets';
+import { createTextureFromPixels, type RuntimeAssetSource } from '../runtime/runtimeAssets';
import { isKtx2Path, type BasisTranscoder } from '../asset/compressed';
import type { DragonBonesManager } from './DragonBonesManager';
diff --git a/sdk/src/ecs/ChangeTracker.ts b/sdk/src/ecs/ChangeTracker.ts
index 39cca25bd..b7b11a2d5 100644
--- a/sdk/src/ecs/ChangeTracker.ts
+++ b/sdk/src/ecs/ChangeTracker.ts
@@ -6,7 +6,7 @@
*/
import { Entity } from '../types';
-import { AnyComponentDef } from '../component';
+import { AnyComponentDef } from './component';
export class ChangeTracker {
private worldTick_ = 0;
diff --git a/sdk/src/ecs/ScriptStorage.ts b/sdk/src/ecs/ScriptStorage.ts
index 90cd219f5..784ca4bdd 100644
--- a/sdk/src/ecs/ScriptStorage.ts
+++ b/sdk/src/ecs/ScriptStorage.ts
@@ -6,7 +6,7 @@
*/
import { Entity } from '../types';
-import { ComponentDef } from '../component';
+import { ComponentDef } from './component';
import { validateComponentData, formatValidationErrors, assetFieldNames } from '../validation';
import { log } from '../logger';
import { reorderMapByRank, type RankOf } from './entityOrder';
diff --git a/sdk/src/ecs/BuiltinBridge.ts b/sdk/src/ecs/bridge/BuiltinBridge.ts
similarity index 98%
rename from sdk/src/ecs/BuiltinBridge.ts
rename to sdk/src/ecs/bridge/BuiltinBridge.ts
index 5da141765..93da08786 100644
--- a/sdk/src/ecs/BuiltinBridge.ts
+++ b/sdk/src/ecs/bridge/BuiltinBridge.ts
@@ -5,15 +5,15 @@
* @brief C++ Registry integration layer for builtin components
*/
-import { Entity } from '../types';
+import { Entity } from '../../types';
import type { BuiltinComponentDef } from '../component';
-import type { CppRegistry, ESEngineModule } from '../wasm';
-import { validateComponentData, formatValidationErrors, assetFieldNames } from '../validation';
-import { handleWasmError } from '../wasmError';
-import { installAbortGuard, throwIfModuleAborted, isModuleAborted, WasmModuleAborted } from '../moduleHealth';
+import type { CppRegistry, ESEngineModule } from '../../wasm';
+import { validateComponentData, formatValidationErrors, assetFieldNames } from '../../validation';
+import { handleWasmError } from '../../wasm/wasmError';
+import { installAbortGuard, throwIfModuleAborted, isModuleAborted, WasmModuleAborted } from '../../wasm/moduleHealth';
import { COMPONENT_META, ABI_LAYOUT_HASH } from '../component.generated';
import { PTR_ACCESSORS } from './ptrAccessors.generated';
-import { reorderSetByRank, type RankOf } from './entityOrder';
+import { reorderSetByRank, type RankOf } from '../entityOrder';
import {
type MemoryProvider, type ComponentHeap,
WasmMemoryProvider, resolveWasmPtrFn,
diff --git a/sdk/src/ecs/engineApi.ts b/sdk/src/ecs/bridge/engineApi.ts
similarity index 98%
rename from sdk/src/ecs/engineApi.ts
rename to sdk/src/ecs/bridge/engineApi.ts
index cb73247dd..4c8ed2bac 100644
--- a/sdk/src/ecs/engineApi.ts
+++ b/sdk/src/ecs/bridge/engineApi.ts
@@ -19,7 +19,7 @@
* left a subsystem out.
*/
-import type { App } from '../app';
+import type { App } from '../../app';
import type { NativeEngineApi } from './nativeEngineApi.generated';
import type { NativeHeap } from './nativeHeap';
diff --git a/sdk/src/ecs/memoryProvider.ts b/sdk/src/ecs/bridge/memoryProvider.ts
similarity index 97%
rename from sdk/src/ecs/memoryProvider.ts
rename to sdk/src/ecs/bridge/memoryProvider.ts
index 77657b4c9..ec7d6bf6a 100644
--- a/sdk/src/ecs/memoryProvider.ts
+++ b/sdk/src/ecs/bridge/memoryProvider.ts
@@ -18,9 +18,9 @@
// the EHT ABI hash), two memory backends — this is the seam that lets the real
// SDK component API run unchanged on both.
-import type { Entity } from '../types';
-import type { CppRegistry, ESEngineModule } from '../wasm';
-import { PTR_LAYOUTS } from '../ptrLayouts.generated';
+import type { Entity } from '../../types';
+import type { CppRegistry, ESEngineModule } from '../../wasm';
+import { PTR_LAYOUTS } from '../../wasm/ptrLayouts.generated';
/**
* Heap views + base byte offset for one component instance. The resolver reuses a
diff --git a/sdk/src/ecs/nativeBindings.ts b/sdk/src/ecs/bridge/nativeBindings.ts
similarity index 100%
rename from sdk/src/ecs/nativeBindings.ts
rename to sdk/src/ecs/bridge/nativeBindings.ts
diff --git a/sdk/src/ecs/nativeEngineApi.generated.ts b/sdk/src/ecs/bridge/nativeEngineApi.generated.ts
similarity index 100%
rename from sdk/src/ecs/nativeEngineApi.generated.ts
rename to sdk/src/ecs/bridge/nativeEngineApi.generated.ts
diff --git a/sdk/src/ecs/nativeHeap.ts b/sdk/src/ecs/bridge/nativeHeap.ts
similarity index 100%
rename from sdk/src/ecs/nativeHeap.ts
rename to sdk/src/ecs/bridge/nativeHeap.ts
diff --git a/sdk/src/ecs/nativeRegistry.ts b/sdk/src/ecs/bridge/nativeRegistry.ts
similarity index 99%
rename from sdk/src/ecs/nativeRegistry.ts
rename to sdk/src/ecs/bridge/nativeRegistry.ts
index ef1bf523c..382ea6b9c 100644
--- a/sdk/src/ecs/nativeRegistry.ts
+++ b/sdk/src/ecs/bridge/nativeRegistry.ts
@@ -14,8 +14,8 @@
// same convertForWasm/convertFromWasm the web methods path uses, keyed off
// COMPONENT_META.colorFields.
-import type { CppRegistry } from '../wasm';
-import type { Entity } from '../types';
+import type { CppRegistry } from '../../wasm';
+import type { Entity } from '../../types';
import { PTR_ACCESSORS } from './ptrAccessors.generated';
import { REGISTRY_BINDINGS, SCENE_QUERY_BINDINGS } from './nativeBindings';
import { COMPONENT_META } from '../component.generated';
diff --git a/sdk/src/ecs/nativeRenderer.ts b/sdk/src/ecs/bridge/nativeRenderer.ts
similarity index 97%
rename from sdk/src/ecs/nativeRenderer.ts
rename to sdk/src/ecs/bridge/nativeRenderer.ts
index fb59eb174..92ab5b942 100644
--- a/sdk/src/ecs/nativeRenderer.ts
+++ b/sdk/src/ecs/bridge/nativeRenderer.ts
@@ -16,8 +16,8 @@
// one calls the host's es_renderer_* bindings with the typed arrays as they are.
// The C++ host keeps what only it can do: the swapchain and the present.
-import type { CppRegistry } from '../wasm';
-import type { RendererBackend, RenderStats } from '../renderer';
+import type { CppRegistry } from '../../wasm';
+import type { RendererBackend, RenderStats } from '../../render/renderer';
import { RENDERER_BINDINGS, RENDERER_STATS_BINDINGS } from './nativeBindings';
/** Invoke a host-provided global by name; throws if the host did not bind it
diff --git a/sdk/src/ecs/nativeResourceManager.ts b/sdk/src/ecs/bridge/nativeResourceManager.ts
similarity index 99%
rename from sdk/src/ecs/nativeResourceManager.ts
rename to sdk/src/ecs/bridge/nativeResourceManager.ts
index 1904a2d84..05e5a807e 100644
--- a/sdk/src/ecs/nativeResourceManager.ts
+++ b/sdk/src/ecs/bridge/nativeResourceManager.ts
@@ -16,7 +16,7 @@
// prefer this byte method when present, so web (embind, no such method) stays
// byte-identical.
-import type { CppResourceManager } from '../wasm';
+import type { CppResourceManager } from '../../wasm';
import { RESOURCE_BINDINGS, TEXT_BINDINGS } from './nativeBindings';
/** `rm_createTextureEx` filter/wrap codes, for the case with no import settings.
diff --git a/sdk/src/ecs/nativeRuntime.ts b/sdk/src/ecs/bridge/nativeRuntime.ts
similarity index 89%
rename from sdk/src/ecs/nativeRuntime.ts
rename to sdk/src/ecs/bridge/nativeRuntime.ts
index b4f6bc828..1bc157c9e 100644
--- a/sdk/src/ecs/nativeRuntime.ts
+++ b/sdk/src/ecs/bridge/nativeRuntime.ts
@@ -10,15 +10,15 @@
// authoring runs in the JS engine, writing the native C++ ECS, which the native
// host renders. No wasm module: entity generations fall back to World's JS path.
-import { App } from '../app';
+import { App } from '../../app';
import { World } from '../world';
-import { inputPlugin } from '../input';
-import { prefabsPlugin } from '../prefabServer';
-import { sceneManagerPlugin } from '../scenePlugin';
-import { headlessBasePlugins } from '../webAppFactory';
-import { presentationBasePlugins } from '../pluginSets';
+import { inputPlugin } from '../../input/input';
+import { prefabsPlugin } from '../../prefabServer';
+import { sceneManagerPlugin } from '../../scenePlugin';
+import { headlessBasePlugins } from '../../runtime/webAppFactory';
+import { presentationBasePlugins } from '../../pluginSets';
import { ensureBuiltinComponentsRegistered } from '../component';
-import { installNativePlatform, type NativeBridge } from '../platform/native';
+import { installNativePlatform, type NativeBridge } from '../../platform/native';
import { createNativeRegistry } from './nativeRegistry';
import { NativeMemoryProvider } from './memoryProvider';
import { createNativeResourceManager } from './nativeResourceManager';
@@ -28,26 +28,26 @@ import { createNativeEngineApi } from './nativeEngineApi.generated';
import { setNativeEngineApi, engineApi } from './engineApi';
import { createNativeHeap } from './nativeHeap';
import { createNativeSideModules } from './nativeSideModules';
-import { initPostProcessAPI } from '../postprocess';
-import { initDrawAPI } from '../draw';
-import { initGeometryAPI } from '../geometry';
-import { initMaterialAPI } from '../material';
-import type { ESEngineModule } from '../wasm';
-import { log } from '../logger';
-import { setRendererBackend } from '../renderer';
-import { RenderPipeline } from '../renderPipeline';
-import { cameraPlugin } from '../camera/CameraPlugin';
-import { UICameraInfo } from '../ui/core/ui-camera-info';
-import { DEFAULT_UI_CAMERA_INFO } from '../corePlugin';
-import { uiPlugin } from '../ui/ui-plugin';
-import { SpinePlugin } from '../spine';
-import { DragonBonesPlugin } from '../dragonbones';
-import { setNativeTextSubmit } from '../ui/text/submit';
-import { initResourceManager } from '../resourceManager';
-import { Assets as AssetsClass } from '../asset/Assets';
-import { Assets as AssetsResource } from '../asset/AssetPlugin';
-import { FileSystemBackend } from '../asset/Backend';
-import { platformLoadImagePixels } from '../platform';
+import { initPostProcessAPI } from '../../postprocess';
+import { initDrawAPI } from '../../render/draw';
+import { initGeometryAPI } from '../../render/geometry';
+import { initMaterialAPI } from '../../render/material';
+import type { ESEngineModule } from '../../wasm';
+import { log } from '../../logger';
+import { setRendererBackend } from '../../render/renderer';
+import { RenderPipeline } from '../../render/renderPipeline';
+import { cameraPlugin } from '../../camera/CameraPlugin';
+import { UICameraInfo } from '../../ui/core/ui-camera-info';
+import { DEFAULT_UI_CAMERA_INFO } from '../../corePlugin';
+import { uiPlugin } from '../../ui/ui-plugin';
+import { SpinePlugin } from '../../spine';
+import { DragonBonesPlugin } from '../../dragonbones';
+import { setNativeTextSubmit } from '../../ui/text/submit';
+import { initResourceManager } from '../../wasm/resourceManager';
+import { Assets as AssetsClass } from '../../asset/Assets';
+import { Assets as AssetsResource } from '../../asset/AssetPlugin';
+import { FileSystemBackend } from '../../asset/Backend';
+import { platformLoadImagePixels } from '../../platform';
/**
* Create a World bound to the native core. `scope` is where the host installed its
diff --git a/sdk/src/ecs/nativeSideModules.ts b/sdk/src/ecs/bridge/nativeSideModules.ts
similarity index 98%
rename from sdk/src/ecs/nativeSideModules.ts
rename to sdk/src/ecs/bridge/nativeSideModules.ts
index db1f71804..8967da484 100644
--- a/sdk/src/ecs/nativeSideModules.ts
+++ b/sdk/src/ecs/bridge/nativeSideModules.ts
@@ -21,13 +21,13 @@
* whose first call is a TypeError.
*/
-import { createSideModuleHost, type SideModuleHost, type SideModule } from '../sideModules/host';
-import { SPINE_VERSIONS, spineModuleId, type SideModuleId } from '../sideModules/registry';
-import { log } from '../logger';
+import { createSideModuleHost, type SideModuleHost, type SideModule } from '../../sideModules/host';
+import { SPINE_VERSIONS, spineModuleId, type SideModuleId } from '../../sideModules/registry';
+import { log } from '../../logger';
import { createNativeHeap, type NativeHeap } from './nativeHeap';
// Not TextEncoder/TextDecoder: this file runs inside QuickJS on a device, which
// has neither. See utf8.ts.
-import { encodeUtf8, decodeUtf8 } from '../utf8';
+import { encodeUtf8, decodeUtf8 } from '../../utf8';
/**
* One global per subsystem that proves the host compiled it in. Picked from the
diff --git a/sdk/src/ecs/ptrAccessors.generated.ts b/sdk/src/ecs/bridge/ptrAccessors.generated.ts
similarity index 100%
rename from sdk/src/ecs/ptrAccessors.generated.ts
rename to sdk/src/ecs/bridge/ptrAccessors.generated.ts
diff --git a/sdk/src/commands.ts b/sdk/src/ecs/commands.ts
similarity index 99%
rename from sdk/src/commands.ts
rename to sdk/src/ecs/commands.ts
index 5b61c5f99..28b8ef922 100644
--- a/sdk/src/commands.ts
+++ b/sdk/src/ecs/commands.ts
@@ -5,11 +5,11 @@
* @brief Deferred entity/component operations
*/
-import { Entity } from './types';
+import { Entity } from '../types';
import { AnyComponentDef, ComponentDef, isBuiltinComponent, Name } from './component';
import type { World } from './world';
import { ResourceDef, ResourceStorage } from './resource';
-import { log } from './logger';
+import { log } from '../logger';
// =============================================================================
// Commands Descriptor (for system parameters)
diff --git a/sdk/src/component.generated.ts b/sdk/src/ecs/component.generated.ts
similarity index 99%
rename from sdk/src/component.generated.ts
rename to sdk/src/ecs/component.generated.ts
index d8d9d2f6f..6acea9cd8 100644
--- a/sdk/src/component.generated.ts
+++ b/sdk/src/ecs/component.generated.ts
@@ -4,10 +4,10 @@
* @details Generated by EHT - DO NOT EDIT
*/
-import type { AssetFieldType } from './scene';
+import type { AssetFieldType } from '../scene';
import type { FieldMeta } from './component';
-import type { Color, Entity, Quat, Vec2, Vec3, Vec4 } from './types';
-import type { Dimension, Padding } from './wasm.generated';
+import type { Color, Entity, Quat, Vec2, Vec3, Vec4 } from '../types';
+import type { Dimension, Padding } from '../wasm/wasm.generated';
/**
* Single-source-of-truth hash of the C++/TS boundary ABI (component
diff --git a/sdk/src/component.ts b/sdk/src/ecs/component.ts
similarity index 99%
rename from sdk/src/component.ts
rename to sdk/src/ecs/component.ts
index dfa0fda4b..a843245dc 100644
--- a/sdk/src/component.ts
+++ b/sdk/src/ecs/component.ts
@@ -5,8 +5,8 @@
* @brief Component definition and builtin components
*/
-import { Entity, Vec2, Vec3, Color, Quat } from './types';
-import { deepClone } from './deepClone';
+import { Entity, Vec2, Vec3, Color, Quat } from '../types';
+import { deepClone } from '../deepClone';
import { COMPONENT_META, type AssetFieldMeta, type SkeletalFieldMeta } from './component.generated';
// C++-backed component data shapes, generated from the ES_COMPONENT structs (single
// source — a TS field can no longer drift from C++). Re-exported below so the public
@@ -24,12 +24,12 @@ import type {
// C++ enum and the editor dropdowns derive from the same values. ScaleMode's
// canonical values come from CanvasScaleMode (only its Cocos-compat aliases
// ShowAll/NoBorder are TS-side).
-import { ProjectionType, ClearFlags, EmitterShape, SimulationSpace, SubEmitterTrigger, ForceFieldType, Light2DType, CanvasScaleMode, ShapeType, ParticleEasing } from './wasm.generated';
-import { BlendMode } from './blend';
+import { ProjectionType, ClearFlags, EmitterShape, SimulationSpace, SubEmitterTrigger, ForceFieldType, Light2DType, CanvasScaleMode, ShapeType, ParticleEasing } from '../wasm/wasm.generated';
+import { BlendMode } from '../render/blend';
import { getDefaultContext } from './context';
import type {
RigidBodyData, BoxColliderData, CircleColliderData, CapsuleColliderData,
-} from './physics/PhysicsComponents';
+} from '../physics/PhysicsComponents';
// =============================================================================
// Self-Describing Component Types
diff --git a/sdk/src/context.ts b/sdk/src/ecs/context.ts
similarity index 100%
rename from sdk/src/context.ts
rename to sdk/src/ecs/context.ts
diff --git a/sdk/src/emitter.ts b/sdk/src/ecs/emitter.ts
similarity index 100%
rename from sdk/src/emitter.ts
rename to sdk/src/ecs/emitter.ts
diff --git a/sdk/src/entityEvents.ts b/sdk/src/ecs/entityEvents.ts
similarity index 99%
rename from sdk/src/entityEvents.ts
rename to sdk/src/ecs/entityEvents.ts
index f6a98c229..6d70f6057 100644
--- a/sdk/src/entityEvents.ts
+++ b/sdk/src/ecs/entityEvents.ts
@@ -20,9 +20,9 @@
* events.ts` names remain as aliases of these very objects.
*/
import { defineResource } from './resource';
-import type { Entity } from './types';
-import type { App } from './app';
-import { log } from './logger';
+import type { Entity } from '../types';
+import type { App } from '../app';
+import { log } from '../logger';
export interface EntityEvent<TData = unknown> {
/** Event type string (e.g. `'click'`, `'change'`). */
diff --git a/sdk/src/entityUtils.ts b/sdk/src/ecs/entityUtils.ts
similarity index 97%
rename from sdk/src/entityUtils.ts
rename to sdk/src/ecs/entityUtils.ts
index c3c7f22d4..ecdf39e7e 100644
--- a/sdk/src/entityUtils.ts
+++ b/sdk/src/ecs/entityUtils.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import type { Entity } from './types';
+import type { Entity } from '../types';
import type { World } from './world';
import { Sprite, ShapeRenderer, BitmapText, Disabled } from './component';
diff --git a/sdk/src/event.ts b/sdk/src/ecs/event.ts
similarity index 100%
rename from sdk/src/event.ts
rename to sdk/src/ecs/event.ts
diff --git a/sdk/src/lifecycle.ts b/sdk/src/ecs/lifecycle.ts
similarity index 98%
rename from sdk/src/lifecycle.ts
rename to sdk/src/ecs/lifecycle.ts
index 7fe213392..df3180306 100644
--- a/sdk/src/lifecycle.ts
+++ b/sdk/src/ecs/lifecycle.ts
@@ -6,9 +6,9 @@
*/
import { defineResource } from './resource';
-import type { App, Plugin } from './app';
-import { getPlatformType, platformOnAppShow, platformOnAppHide } from './platform';
-import { log } from './logger';
+import type { App, Plugin } from '../app';
+import { getPlatformType, platformOnAppShow, platformOnAppHide } from '../platform';
+import { log } from '../logger';
// =============================================================================
// Lifecycle State
diff --git a/sdk/src/query.ts b/sdk/src/ecs/query.ts
similarity index 99%
rename from sdk/src/query.ts
rename to sdk/src/ecs/query.ts
index bdde0c6aa..6c4237640 100644
--- a/sdk/src/query.ts
+++ b/sdk/src/ecs/query.ts
@@ -5,7 +5,7 @@
* @brief Component query system with mutable component support
*/
-import { Entity } from './types';
+import { Entity } from '../types';
import { AnyComponentDef, ComponentData, isBuiltinComponent } from './component';
import type { World, QueryFilter } from './world';
import { computeQueryCacheKey } from './world';
diff --git a/sdk/src/resource.ts b/sdk/src/ecs/resource.ts
similarity index 99%
rename from sdk/src/resource.ts
rename to sdk/src/ecs/resource.ts
index 38df61b0f..f9d41c676 100644
--- a/sdk/src/resource.ts
+++ b/sdk/src/ecs/resource.ts
@@ -5,7 +5,7 @@
* @brief Resource system for global singleton data
*/
-import { deepClone } from './deepClone';
+import { deepClone } from '../deepClone';
// =============================================================================
// Resource Definition
diff --git a/sdk/src/system.ts b/sdk/src/ecs/system.ts
similarity index 100%
rename from sdk/src/system.ts
rename to sdk/src/ecs/system.ts
diff --git a/sdk/src/systemLabels.ts b/sdk/src/ecs/systemLabels.ts
similarity index 100%
rename from sdk/src/systemLabels.ts
rename to sdk/src/ecs/systemLabels.ts
diff --git a/sdk/src/transaction.ts b/sdk/src/ecs/transaction.ts
similarity index 99%
rename from sdk/src/transaction.ts
rename to sdk/src/ecs/transaction.ts
index 42aa53ba2..6065dc81a 100644
--- a/sdk/src/transaction.ts
+++ b/sdk/src/ecs/transaction.ts
@@ -10,7 +10,7 @@
* re-deriving state. TransactionManager holds the undo/redo stacks.
*/
-import { log } from './logger';
+import { log } from '../logger';
// =============================================================================
// Types
diff --git a/sdk/src/world.ts b/sdk/src/ecs/world.ts
similarity index 97%
rename from sdk/src/world.ts
rename to sdk/src/ecs/world.ts
index cdb892c0b..090f9be26 100644
--- a/sdk/src/world.ts
+++ b/sdk/src/ecs/world.ts
@@ -5,19 +5,19 @@
* @brief ECS World with C++ Registry integration
*/
-import { Entity, entityGeneration, entityIndex, makeEntity, INVALID_ENTITY } from './types';
+import { Entity, entityGeneration, entityIndex, makeEntity, INVALID_ENTITY } from '../types';
import { AnyComponentDef, ComponentDef, ComponentData, BuiltinComponentDef, isBuiltinComponent, getComponentRegistry, getUserComponents, getComponent, Name, Parent, Children } from './component';
-import type { CppRegistry, ESEngineModule } from './wasm';
-import { handleWasmError } from './wasmError';
-import { BuiltinBridge, convertFromWasm, convertForWasm, type BridgeConnectOptions, type BuiltinMethods } from './ecs/BuiltinBridge';
-import { ScriptStorage } from './ecs/ScriptStorage';
-import { NameIndex } from './ecs/NameIndex';
-import { ChangeTracker } from './ecs/ChangeTracker';
-import { QueryCache, type QueryCacheStats } from './ecs/QueryCache';
-import { rankByOrder, reorderMapByRank } from './ecs/entityOrder';
-import { nativeEngineApi } from './ecs/engineApi';
-import { withScratch } from './wasmScratch';
-import { log } from './logger';
+import type { CppRegistry, ESEngineModule } from '../wasm';
+import { handleWasmError } from '../wasm/wasmError';
+import { BuiltinBridge, convertFromWasm, convertForWasm, type BridgeConnectOptions, type BuiltinMethods } from './bridge/BuiltinBridge';
+import { ScriptStorage } from './ScriptStorage';
+import { NameIndex } from './NameIndex';
+import { ChangeTracker } from './ChangeTracker';
+import { QueryCache, type QueryCacheStats } from './QueryCache';
+import { rankByOrder, reorderMapByRank } from './entityOrder';
+import { nativeEngineApi } from './bridge/engineApi';
+import { withScratch } from '../wasm/wasmScratch';
+import { log } from '../logger';
import { getDefaultContext, type EditorBridge } from './context';
/** The slice of a core {@link World.applyEntityOrder} needs: the entry point plus
@@ -49,9 +49,9 @@ function notifyBridge<K extends keyof EditorBridge>(
}
}
-export { PTR_LAYOUTS } from './ptrLayouts.generated';
-export { BuiltinBridge } from './ecs/BuiltinBridge';
-export type { BuiltinMethods } from './ecs/BuiltinBridge';
+export { PTR_LAYOUTS } from '../wasm/ptrLayouts.generated';
+export { BuiltinBridge } from './bridge/BuiltinBridge';
+export type { BuiltinMethods } from './bridge/BuiltinBridge';
// =============================================================================
// Numeric Component IDs for Cache Keys
diff --git a/sdk/src/env.ts b/sdk/src/env.ts
index 66d6a1e6a..809981224 100644
--- a/sdk/src/env.ts
+++ b/sdk/src/env.ts
@@ -9,7 +9,7 @@
* functions are the stable public surface; gameplay systems gate on
* {@link playModeOnly}.
*/
-import { getDefaultContext } from './context';
+import { getDefaultContext } from './ecs/context';
export function setEditorMode(active: boolean): void {
getDefaultContext().editorMode = active;
diff --git a/sdk/src/eventBinding.ts b/sdk/src/eventBinding.ts
index 29533c044..cd619e46d 100644
--- a/sdk/src/eventBinding.ts
+++ b/sdk/src/eventBinding.ts
@@ -24,17 +24,17 @@
* Nearest-wins is what keeps two instances of the same prefab from wiring
* into each other.
*/
-import { defineComponent, Children, Name, Parent } from './component';
-import type { ChildrenData, NameData, ParentData } from './component';
+import { defineComponent, Children, Name, Parent } from './ecs/component';
+import type { ChildrenData, NameData, ParentData } from './ecs/component';
import type { App, Plugin } from './app';
import type { Entity } from './types';
-import type { World } from './world';
-import { defineSystem, Schedule } from './system';
-import { Commands, type CommandsInstance } from './commands';
-import { Res, Time, type TimeData } from './resource';
+import type { World } from './ecs/world';
+import { defineSystem, Schedule } from './ecs/system';
+import { Commands, type CommandsInstance } from './ecs/commands';
+import { Res, Time, type TimeData } from './ecs/resource';
import { playModeOnly } from './env';
import { log } from './logger';
-import { ensureEntityEvents, EntityEventQueue, type EntityEvent, type Unsubscribe } from './entityEvents';
+import { ensureEntityEvents, EntityEventQueue, type EntityEvent, type Unsubscribe } from './ecs/entityEvents';
import { Blackboard } from './ai/fsm/Blackboard';
import { aiRegistry, type AiContext } from './ai/fsm/AiContext';
import { invokeAction, type AiParamValue } from './ai/fsm/registry';
diff --git a/sdk/src/hotReload.ts b/sdk/src/hotReload.ts
index 7208d38ab..8a9ee1c73 100644
--- a/sdk/src/hotReload.ts
+++ b/sdk/src/hotReload.ts
@@ -5,8 +5,8 @@
* @brief State-preserving hot-reload support (RC10 P3): collect a project bundle's
* re-registrations in isolation so the editor can decide hot-swap vs reload.
*/
-import { AppContext, getDefaultContext, setDefaultContext, type PendingSystemEntry } from './context';
-import { getUserComponentFingerprint, seedEngineComponents } from './component';
+import { AppContext, getDefaultContext, setDefaultContext, type PendingSystemEntry } from './ecs/context';
+import { getUserComponentFingerprint, seedEngineComponents } from './ecs/component';
export interface ProbedRegistrations {
/** Digest of the user component schemas the bundle declared (shape, not values). */
diff --git a/sdk/src/hotUpdateRebind.ts b/sdk/src/hotUpdateRebind.ts
index 5e3847203..711c8433c 100644
--- a/sdk/src/hotUpdateRebind.ts
+++ b/sdk/src/hotUpdateRebind.ts
@@ -13,9 +13,9 @@
* per install, not module-global — so realms don't share queues.
*/
import type { App } from './app';
-import { Schedule, defineSystem } from './system';
-import { Query, Mut } from './query';
-import { Sprite, Mesh2D } from './component';
+import { Schedule, defineSystem } from './ecs/system';
+import { Query, Mut } from './ecs/query';
+import { Sprite, Mesh2D } from './ecs/component';
import type { Assets } from './asset/Assets';
export function installHotUpdateRebind(app: App, assets: Assets): void {
diff --git a/sdk/src/i18n/Localization.ts b/sdk/src/i18n/Localization.ts
index 16e46e069..0a1df1570 100644
--- a/sdk/src/i18n/Localization.ts
+++ b/sdk/src/i18n/Localization.ts
@@ -9,7 +9,7 @@
* per locale for languages whose rules differ from the default.
*/
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
export type PluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
diff --git a/sdk/src/i18n/LocalizationPlugin.ts b/sdk/src/i18n/LocalizationPlugin.ts
index 342aeacea..fab624dce 100644
--- a/sdk/src/i18n/LocalizationPlugin.ts
+++ b/sdk/src/i18n/LocalizationPlugin.ts
@@ -6,7 +6,7 @@
* `app.addPlugin(localizationPlugin)` or with options.
*/
import type { App, Plugin } from '../app';
-import { Schedule, defineSystem } from '../system';
+import { Schedule, defineSystem } from '../ecs/system';
import { Assets } from '../asset/AssetPlugin';
import { log } from '../logger';
import { Localization, LocalizationAPI, type LocaleCatalog } from './Localization';
diff --git a/sdk/src/index.minigame.ts b/sdk/src/index.minigame.ts
index 8594f6794..5b4e12aed 100644
--- a/sdk/src/index.minigame.ts
+++ b/sdk/src/index.minigame.ts
@@ -32,7 +32,7 @@
* @beta Pre-1.0: the profile contract may still gain fields as vendors beyond
* WeChat are brought up against real devices.
*/
-import { ensureBuiltinComponentsRegistered, markEngineComponentBaseline } from './component';
+import { ensureBuiltinComponentsRegistered, markEngineComponentBaseline } from './ecs/component';
import { ensureBuiltinAiRegistrations } from './ai/builtins';
// No setPlatform here — the game calls installMiniGamePlatform(profile) at boot.
@@ -43,7 +43,7 @@ ensureBuiltinAiRegistrations();
markEngineComponentBaseline();
export * from './core';
-export * from './webAppFactory';
+export * from './runtime/webAppFactory';
// The family platform: describe the host as data, install, done.
export { MiniGamePlatformAdapter, installMiniGamePlatform } from './platform/minigame';
@@ -65,7 +65,7 @@ export type {
} from './platform/minigame';
// The boot the exporter's generated game.js calls.
-export { initMiniGameRuntime, type MiniGameRuntimeConfig } from './miniGameRuntime';
+export { initMiniGameRuntime, type MiniGameRuntimeConfig } from './runtime/miniGameRuntime';
// The family backends, exported so a profile can wrap or replace one rather than
// write it from scratch.
diff --git a/sdk/src/index.native.ts b/sdk/src/index.native.ts
index a8914fa38..30f8deb34 100644
--- a/sdk/src/index.native.ts
+++ b/sdk/src/index.native.ts
@@ -21,7 +21,7 @@
* @beta Pre-1.0: the native host is unshipped; this entry's shape (and the
* NativeBridge contract) will change as the shell lands.
*/
-import { ensureBuiltinComponentsRegistered, markEngineComponentBaseline } from './component';
+import { ensureBuiltinComponentsRegistered, markEngineComponentBaseline } from './ecs/component';
import { ensureBuiltinAiRegistrations } from './ai/builtins';
// No setPlatform here — the shell calls installNativePlatform(bridge) at boot.
@@ -32,7 +32,7 @@ ensureBuiltinAiRegistrations();
markEngineComponentBaseline();
export * from './core';
-export * from './webAppFactory';
+export * from './runtime/webAppFactory';
export { NativePlatformAdapter, installNativePlatform, createHostBridge, assertHostEnvironment, assertNativeHost } from './platform/native';
export type { NativeBridge, NativeInputListener, NativeFetchResult, NativeHostBindings } from './platform/native';
@@ -41,37 +41,37 @@ export type { NativeBridge, NativeInputListener, NativeFetchResult, NativeHostBi
// host-injected `es_<Component>_buffer` bindings and passes it to the bridge
// (BuiltinBridge.connect's `memory` option), so the real SDK component API reads
// and writes native ECS memory through the same generated ptrAccessors as web.
-export { NativeMemoryProvider } from './ecs/memoryProvider';
-export type { MemoryProvider, ComponentHeap, NativeComponentBufferFn } from './ecs/memoryProvider';
+export { NativeMemoryProvider } from './ecs/bridge/memoryProvider';
+export type { MemoryProvider, ComponentHeap, NativeComponentBufferFn } from './ecs/bridge/memoryProvider';
// The native component registry — the embind-Registry sibling the SDK's bridge
// drives (add/get/has/remove). Built over the host's es_<Component>_buffer/_has/
// _remove bindings; pass to BuiltinBridge.connect as the cppRegistry.
-export { createNativeRegistry } from './ecs/nativeRegistry';
+export { createNativeRegistry } from './ecs/bridge/nativeRegistry';
// The es_* names a host binds, declared once and checked at boot.
-export { REGISTRY_BINDINGS, RESOURCE_BINDINGS, PLATFORM_BINDINGS, assertNativeBindings } from './ecs/nativeBindings';
+export { REGISTRY_BINDINGS, RESOURCE_BINDINGS, PLATFORM_BINDINGS, assertNativeBindings } from './ecs/bridge/nativeBindings';
// The native ResourceManager — the embind-ResourceManager sibling the SDK's asset
// pipeline drives (createTexture / releaseTexture / dims). Built over the host's
// es_createTexture / es_releaseTexture / es_getTextureDimensions bindings; uploads
// texture bytes directly (no wasm heap). createNativeApp installs one automatically.
-export { createNativeResourceManager } from './ecs/nativeResourceManager';
+export { createNativeResourceManager } from './ecs/bridge/nativeResourceManager';
// Boot the real SDK ECS World over the native core — the host's entry point for
// running the actual SDK (spawn/insert/query authoring) against native C++ ECS.
-export { createNativeWorld } from './ecs/nativeRuntime';
+export { createNativeWorld } from './ecs/bridge/nativeRuntime';
// Boot a native App: the same App + the native platform (input via the host's
// NativeBridge) + native ECS. The system-binding layer (Stage B) over the World.
-export { createNativeApp } from './ecs/nativeRuntime';
+export { createNativeApp } from './ecs/bridge/nativeRuntime';
// Boot an EXPORTED project (cooked assets + scenes + game.config.json read off
// the device) rather than a hand-written game script — the native sibling of the
// WeChat runtime and the web game host.
-export { initNativeGame } from './nativeGameRuntime';
-export type { NativeGame, NativeGameOptions } from './nativeGameRuntime';
+export { initNativeGame } from './runtime/nativeGameRuntime';
+export type { NativeGame, NativeGameOptions } from './runtime/nativeGameRuntime';
// ABI layout hash of the component schema this bundle was generated from — the
// native shell compares it against the wasm build it loads (same as the editor).
-export { ABI_LAYOUT_HASH } from './component.generated';
+export { ABI_LAYOUT_HASH } from './ecs/component.generated';
diff --git a/sdk/src/index.node.ts b/sdk/src/index.node.ts
index 2693c3a15..526bc85eb 100644
--- a/sdk/src/index.node.ts
+++ b/sdk/src/index.node.ts
@@ -15,7 +15,7 @@
*/
import { setPlatform } from './platform';
import { nodeAdapter } from './platform/node';
-import { ensureBuiltinComponentsRegistered, markEngineComponentBaseline } from './component';
+import { ensureBuiltinComponentsRegistered, markEngineComponentBaseline } from './ecs/component';
import { ensureBuiltinAiRegistrations } from './ai/builtins';
import type { ESEngineModule } from './wasm';
@@ -28,7 +28,7 @@ ensureBuiltinAiRegistrations();
markEngineComponentBaseline();
export * from './core';
-export * from './webAppFactory';
+export * from './runtime/webAppFactory';
export { nodeAdapter } from './platform/node';
/**
diff --git a/sdk/src/index.ts b/sdk/src/index.ts
index 5da098dd8..ab01f7636 100644
--- a/sdk/src/index.ts
+++ b/sdk/src/index.ts
@@ -6,7 +6,7 @@
*/
import { setPlatform, webAdapter } from './platform';
-import { ensureBuiltinComponentsRegistered, markEngineComponentBaseline } from './component';
+import { ensureBuiltinComponentsRegistered, markEngineComponentBaseline } from './ecs/component';
import { ensureBuiltinAiRegistrations } from './ai/builtins';
setPlatform(webAdapter);
@@ -22,10 +22,10 @@ ensureBuiltinAiRegistrations();
markEngineComponentBaseline();
export * from './core';
-export * from './webAppFactory';
+export * from './runtime/webAppFactory';
// ABI layout hash of the component schema this SDK bundle was generated from.
// Exposed so an embedding host (e.g. the editor) can compare it against the
// wasm build it loads — see desktop EngineGuard. The authoritative, fatal
// layout check still happens inside the runtime bridge handshake.
-export { ABI_LAYOUT_HASH } from './component.generated';
+export { ABI_LAYOUT_HASH } from './ecs/component.generated';
diff --git a/sdk/src/index.wechat.ts b/sdk/src/index.wechat.ts
index 626fc0ec5..5f1e078fa 100644
--- a/sdk/src/index.wechat.ts
+++ b/sdk/src/index.wechat.ts
@@ -7,7 +7,7 @@
import { setPlatform } from './platform';
import { wechatAdapter, initWeChatPlatform } from './platform/wechat';
-import { ensureBuiltinComponentsRegistered, markEngineComponentBaseline } from './component';
+import { ensureBuiltinComponentsRegistered, markEngineComponentBaseline } from './ecs/component';
import { ensureBuiltinAiRegistrations } from './ai/builtins';
initWeChatPlatform();
@@ -20,7 +20,7 @@ ensureBuiltinAiRegistrations();
markEngineComponentBaseline();
export * from './core';
-export * from './webAppFactory';
+export * from './runtime/webAppFactory';
export {
wxReadFile,
@@ -37,4 +37,4 @@ export {
export {
initWeChatRuntime,
type WeChatRuntimeConfig,
-} from './wechatRuntime';
+} from './runtime/wechatRuntime';
diff --git a/sdk/src/gesture.ts b/sdk/src/input/gesture.ts
similarity index 100%
rename from sdk/src/gesture.ts
rename to sdk/src/input/gesture.ts
diff --git a/sdk/src/hitArea.ts b/sdk/src/input/hitArea.ts
similarity index 100%
rename from sdk/src/hitArea.ts
rename to sdk/src/input/hitArea.ts
diff --git a/sdk/src/input.ts b/sdk/src/input/input.ts
similarity index 97%
rename from sdk/src/input.ts
rename to sdk/src/input/input.ts
index 95af4b26f..a868f2a56 100644
--- a/sdk/src/input.ts
+++ b/sdk/src/input/input.ts
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { defineResource } from './resource';
-import { defineSystem, Schedule } from './system';
-import type { App, Plugin } from './app';
-import { getPlatform, platformUnbindInputEvents } from './platform';
-import type { GamepadSnapshot } from './platform/types';
+import { defineResource } from '../ecs/resource';
+import { defineSystem, Schedule } from '../ecs/system';
+import type { App, Plugin } from '../app';
+import { getPlatform, platformUnbindInputEvents } from '../platform';
+import type { GamepadSnapshot } from '../platform/types';
import { inputRouter } from './inputRouter';
export interface TouchPoint {
diff --git a/sdk/src/inputMap.ts b/sdk/src/input/inputMap.ts
similarity index 98%
rename from sdk/src/inputMap.ts
rename to sdk/src/input/inputMap.ts
index e131d0dcf..5f21ff0b0 100644
--- a/sdk/src/inputMap.ts
+++ b/sdk/src/input/inputMap.ts
@@ -12,10 +12,10 @@
* existing resource/system model — a `defineInputMap` registers ONE evaluation
* system that reads the raw `Input` resource each frame (REARCH_INPUT.md §2.2).
*/
-import { Schedule, defineSystem, addSystemToSchedule } from './system';
-import { Res } from './resource';
+import { Schedule, defineSystem, addSystemToSchedule } from '../ecs/system';
+import { Res } from '../ecs/resource';
import { Input, InputState, GamepadAxis, GamepadButton } from './input';
-import { Storage } from './storage';
+import { Storage } from '../storage';
// =============================================================================
// Binding model (plain, serializable — also the rebind / persistence format)
diff --git a/sdk/src/inputRouter.ts b/sdk/src/input/inputRouter.ts
similarity index 100%
rename from sdk/src/inputRouter.ts
rename to sdk/src/input/inputRouter.ts
diff --git a/sdk/src/net/GameSocket.ts b/sdk/src/net/GameSocket.ts
index 5fea21f4c..cc7dd3f67 100644
--- a/sdk/src/net/GameSocket.ts
+++ b/sdk/src/net/GameSocket.ts
@@ -4,7 +4,7 @@
* @file GameSocket.ts
* @brief Raw browser-WebSocket wrapper behind the platform socket seam.
*/
-import { Emitter } from '../emitter';
+import { Emitter } from '../ecs/emitter';
import type {
PlatformSocket,
PlatformSocketEvents,
diff --git a/sdk/src/net/MemoryTransport.ts b/sdk/src/net/MemoryTransport.ts
index 9ec5cb430..87613fd97 100644
--- a/sdk/src/net/MemoryTransport.ts
+++ b/sdk/src/net/MemoryTransport.ts
@@ -9,7 +9,7 @@
* pumps them, which is how delivery order, latency and packet
* interleaving are simulated.
*/
-import { Emitter } from '../emitter';
+import { Emitter } from '../ecs/emitter';
import type { NetTransport } from './NetChannel';
export interface MemoryTransportOptions {
diff --git a/sdk/src/net/MessagePortTransport.ts b/sdk/src/net/MessagePortTransport.ts
index 27ed5ca9e..1f1f9572d 100644
--- a/sdk/src/net/MessagePortTransport.ts
+++ b/sdk/src/net/MessagePortTransport.ts
@@ -8,7 +8,7 @@
* (JSON strings and ArrayBuffer frames) natively, and a port queues
* messages until the other end attaches, so wiring order is free.
*/
-import { Emitter } from '../emitter';
+import { Emitter } from '../ecs/emitter';
import type { NetTransport } from './NetChannel';
/** The minimal MessagePort surface (structural — works for window and worker
diff --git a/sdk/src/net/MiniGameSocket.ts b/sdk/src/net/MiniGameSocket.ts
index f833a4cd0..656e02016 100644
--- a/sdk/src/net/MiniGameSocket.ts
+++ b/sdk/src/net/MiniGameSocket.ts
@@ -10,7 +10,7 @@
* normalized {@link MiniGameSocketTask} — so it is the socket for every
* vendor of the family, not for one of them.
*/
-import { Emitter } from '../emitter';
+import { Emitter } from '../ecs/emitter';
import type { PlatformSocket, PlatformSocketEvents } from '../platform/types';
import type { MiniGameGlobal, MiniGameSocketTask } from '../platform/minigame/api';
import type { GameSocketOptions, SocketReadyState } from './GameSocket';
diff --git a/sdk/src/net/replication/ReplicationPlugin.ts b/sdk/src/net/replication/ReplicationPlugin.ts
index 5e4fcda38..58eb7dc69 100644
--- a/sdk/src/net/replication/ReplicationPlugin.ts
+++ b/sdk/src/net/replication/ReplicationPlugin.ts
@@ -10,8 +10,8 @@
* 'offline', so the plugin is safe to install unconditionally.
*/
import type { App, Plugin } from '../../app';
-import { defineSystem, Schedule } from '../../system';
-import { defineResource, Res, Time, type TimeData } from '../../resource';
+import { defineSystem, Schedule } from '../../ecs/system';
+import { defineResource, Res, Time, type TimeData } from '../../ecs/resource';
import type { NetTransport } from '../NetChannel';
import { ReplicationServer } from './server';
import { ReplicationClient, type ReplicationClientOptions } from './client';
diff --git a/sdk/src/net/replication/client.ts b/sdk/src/net/replication/client.ts
index 5448b3742..8f1a361ca 100644
--- a/sdk/src/net/replication/client.ts
+++ b/sdk/src/net/replication/client.ts
@@ -21,10 +21,10 @@
* authoritative value before the replay. Owned entities bypass
* snapshot interpolation entirely.
*/
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import type { Entity } from '../../types';
-import { getComponent } from '../../component';
-import { ABI_LAYOUT_HASH } from '../../component.generated';
+import { getComponent } from '../../ecs/component';
+import { ABI_LAYOUT_HASH } from '../../ecs/component.generated';
import { loadComponent } from '../../scene';
import { NetChannel, type NetTransport } from '../NetChannel';
import { log } from '../../logger';
diff --git a/sdk/src/net/replication/codec.ts b/sdk/src/net/replication/codec.ts
index 97bc2d1d2..3611a505c 100644
--- a/sdk/src/net/replication/codec.ts
+++ b/sdk/src/net/replication/codec.ts
@@ -19,7 +19,7 @@
* declaration order, entity-ref field → u32 netId (remapped at both
* ends), anything else → JSON string fallback.
*/
-import { getComponentRegistry, type AnyComponentDef } from '../../component';
+import { getComponentRegistry, type AnyComponentDef } from '../../ecs/component';
import { REPLICATION_PROTOCOL_VERSION, type ReplComponentSchema } from './protocol';
const FRAME_MAGIC = 0x45535250; // 'ESRP'
diff --git a/sdk/src/net/replication/components.ts b/sdk/src/net/replication/components.ts
index 25d6d395c..fde8a1838 100644
--- a/sdk/src/net/replication/components.ts
+++ b/sdk/src/net/replication/components.ts
@@ -9,7 +9,7 @@
* proxies so local simulation (physics, AI) can yield to the incoming
* authoritative state via Without(NetGhost) queries.
*/
-import { defineComponent, defineTag } from '../../component';
+import { defineComponent, defineTag } from '../../ecs/component';
export interface ReplicatedData {
/** Stable network identity, allocated by the server (0 = unassigned). */
diff --git a/sdk/src/net/replication/interest.ts b/sdk/src/net/replication/interest.ts
index d8cdb644c..18dd39c9f 100644
--- a/sdk/src/net/replication/interest.ts
+++ b/sdk/src/net/replication/interest.ts
@@ -12,9 +12,9 @@
* connection always sees the entities it owns, and with no policy installed
* every connection sees everything (the pre-interest broadcast behavior).
*/
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import type { Entity } from '../../types';
-import { getComponent } from '../../component';
+import { getComponent } from '../../ecs/component';
import { Replicated, type ReplicatedData } from './components';
/** What a policy sees when the server asks it for one connection's interest. */
diff --git a/sdk/src/net/replication/server.ts b/sdk/src/net/replication/server.ts
index ec19d53f9..3eb27bab1 100644
--- a/sdk/src/net/replication/server.ts
+++ b/sdk/src/net/replication/server.ts
@@ -16,10 +16,10 @@
* despawns. Without a policy every ready connection sees everything
* on a single broadcast frame (the fast path).
*/
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import type { Entity } from '../../types';
-import { Name, Parent, getComponent } from '../../component';
-import { ABI_LAYOUT_HASH } from '../../component.generated';
+import { Name, Parent, getComponent } from '../../ecs/component';
+import { ABI_LAYOUT_HASH } from '../../ecs/component.generated';
import { serializeEntityComponents, type SceneComponentData } from '../../scene';
import { NetChannel, type NetTransport } from '../NetChannel';
import { log } from '../../logger';
diff --git a/sdk/src/particle/ParticleAPI.ts b/sdk/src/particle/ParticleAPI.ts
index fdce807d6..7dd0b304b 100644
--- a/sdk/src/particle/ParticleAPI.ts
+++ b/sdk/src/particle/ParticleAPI.ts
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { CppRegistry } from '../wasm';
-import type { EngineApi } from '../ecs/engineApi';
+import type { EngineApi } from '../ecs/bridge/engineApi';
import type { Entity } from '../types';
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
/**
* Per-app particle API. Wraps the C++ registry-scoped particle system
diff --git a/sdk/src/particle/ParticlePlugin.ts b/sdk/src/particle/ParticlePlugin.ts
index 653b5aa39..49af38848 100644
--- a/sdk/src/particle/ParticlePlugin.ts
+++ b/sdk/src/particle/ParticlePlugin.ts
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from '../app';
-import { defineSystem, Schedule } from '../system';
-import { Res } from '../resource';
-import { Time, type TimeData } from '../resource';
+import { defineSystem, Schedule } from '../ecs/system';
+import { Res } from '../ecs/resource';
+import { Time, type TimeData } from '../ecs/resource';
import { fxPreviewOrPlayMode } from '../env';
import type { CppRegistry } from '../wasm';
-import { engineApi } from '../ecs/engineApi';
+import { engineApi } from '../ecs/bridge/engineApi';
import { registerSceneComponentCodec } from '../scene';
import { Particle, ParticleAPI } from './ParticleAPI';
import { bakeGradient, type Gradient } from './gradient';
diff --git a/sdk/src/physics/CharacterController.ts b/sdk/src/physics/CharacterController.ts
index 52b14a20c..df56d02e5 100644
--- a/sdk/src/physics/CharacterController.ts
+++ b/sdk/src/physics/CharacterController.ts
@@ -22,17 +22,17 @@
*/
import type { App } from '../app';
import type { Entity, Vec2 } from '../types';
-import { defineComponent, Transform, type TransformData } from '../component';
-import { Schedule, defineSystem, GetWorld } from '../system';
-import { Query, Mut } from '../query';
-import { Res, Time, type TimeData } from '../resource';
+import { defineComponent, Transform, type TransformData } from '../ecs/component';
+import { Schedule, defineSystem, GetWorld } from '../ecs/system';
+import { Query, Mut } from '../ecs/query';
+import { Res, Time, type TimeData } from '../ecs/resource';
import { playModeOnly } from '../env';
import { Physics, type PhysicsAPI } from './Physics';
import { BoxCollider, CircleCollider, CapsuleCollider } from './PhysicsComponents';
import type {
BoxColliderData, CircleColliderData, CapsuleColliderData,
} from './PhysicsComponents';
-import type { World } from '../world';
+import type { World } from '../ecs/world';
// =============================================================================
// Component
diff --git a/sdk/src/physics/ColliderShape.ts b/sdk/src/physics/ColliderShape.ts
index a1114fd52..54e8a6453 100644
--- a/sdk/src/physics/ColliderShape.ts
+++ b/sdk/src/physics/ColliderShape.ts
@@ -14,7 +14,7 @@
* (pixels-per-unit) scales them to world pixels in shapeCenter / colliderShapeOutline.
*/
import type { Vec2 } from '../types';
-import type { World } from '../world';
+import type { World } from '../ecs/world';
import {
BoxCollider, CircleCollider, CapsuleCollider,
SegmentCollider, PolygonCollider, ChainCollider,
diff --git a/sdk/src/physics/Physics.ts b/sdk/src/physics/Physics.ts
index 6002fb45a..e9badba0d 100644
--- a/sdk/src/physics/Physics.ts
+++ b/sdk/src/physics/Physics.ts
@@ -12,7 +12,7 @@
import type { App } from '../app';
import type { Entity, Vec2 } from '../types';
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
import type { PhysicsWasmModule } from './PhysicsModuleLoader';
import { PhysicsRuntime } from './PhysicsRuntime';
import { PhysicsDebugDraw, type PhysicsDebugDrawConfig } from './PhysicsDebugDraw';
diff --git a/sdk/src/physics/PhysicsBridge.ts b/sdk/src/physics/PhysicsBridge.ts
index 55f23029d..d92a0444c 100644
--- a/sdk/src/physics/PhysicsBridge.ts
+++ b/sdk/src/physics/PhysicsBridge.ts
@@ -11,7 +11,7 @@
* previously called straight into a possibly-dead module.
*/
-import { WasmBridge } from '../WasmBridge';
+import { WasmBridge } from '../wasm/WasmBridge';
import type { PhysicsWasmModule } from './PhysicsModuleLoader';
export class PhysicsBridge extends WasmBridge<PhysicsWasmModule> {
diff --git a/sdk/src/physics/PhysicsComponents.ts b/sdk/src/physics/PhysicsComponents.ts
index 6114f04d3..fca313697 100644
--- a/sdk/src/physics/PhysicsComponents.ts
+++ b/sdk/src/physics/PhysicsComponents.ts
@@ -6,7 +6,7 @@
*/
import type { Vec2 } from '../types';
-import { defineBuiltin, defineComponent } from '../component';
+import { defineBuiltin, defineComponent } from '../ecs/component';
// Box2D collision filtering: a body's own layers (category) and the layers it
// collides with (mask), as named bitmasks. Bit labels come from the project's
@@ -108,7 +108,7 @@ export interface ChainColliderData {
// Single-sourced from the C++ BodyType ES_ENUM via the generated module — the
// hand-restated `as const` copy this replaced could drift from C++.
-export { BodyType } from '../wasm.generated';
+export { BodyType } from '../wasm/wasm.generated';
// =============================================================================
// Builtin Component Instances
diff --git a/sdk/src/physics/PhysicsDebugDraw.ts b/sdk/src/physics/PhysicsDebugDraw.ts
index 76f16637b..a744db2ee 100644
--- a/sdk/src/physics/PhysicsDebugDraw.ts
+++ b/sdk/src/physics/PhysicsDebugDraw.ts
@@ -2,14 +2,14 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App } from '../app';
import type { Color } from '../types';
-import type { TransformData, CanvasData } from '../component';
-import type { ResourceDef } from '../resource';
+import type { TransformData, CanvasData } from '../ecs/component';
+import type { ResourceDef } from '../ecs/resource';
import type { RigidBodyData } from './PhysicsComponents';
import type { PhysicsEventsData } from './PhysicsPlugin';
-import { Transform, Canvas } from '../component';
-import { Draw } from '../draw';
-import { defineResource } from '../resource';
-import { registerDrawCallback } from '../customDraw';
+import { Transform, Canvas } from '../ecs/component';
+import { Draw } from '../render/draw';
+import { defineResource } from '../ecs/resource';
+import { registerDrawCallback } from '../render/customDraw';
import { RigidBody, BodyType } from './PhysicsComponents';
import { readColliderShapes, shapeCenter, colliderShapeOutline } from './ColliderShape';
diff --git a/sdk/src/physics/PhysicsEventBridge.ts b/sdk/src/physics/PhysicsEventBridge.ts
index 2b6808d2e..841168305 100644
--- a/sdk/src/physics/PhysicsEventBridge.ts
+++ b/sdk/src/physics/PhysicsEventBridge.ts
@@ -15,10 +15,10 @@
* each side receives the OTHER entity in the payload.
*/
import type { App } from '../app';
-import { Schedule, defineSystem } from '../system';
-import { Res } from '../resource';
+import { Schedule, defineSystem } from '../ecs/system';
+import { Res } from '../ecs/resource';
import { playModeOnly } from '../env';
-import { ensureEntityEvents } from '../entityEvents';
+import { ensureEntityEvents } from '../ecs/entityEvents';
import { PhysicsEvents, type PhysicsEventsData } from './PhysicsTypes';
import type { Entity } from '../types';
diff --git a/sdk/src/physics/PhysicsPlugin.ts b/sdk/src/physics/PhysicsPlugin.ts
index f348aef09..43c595b69 100644
--- a/sdk/src/physics/PhysicsPlugin.ts
+++ b/sdk/src/physics/PhysicsPlugin.ts
@@ -29,7 +29,7 @@ import {
type PhysicsPluginConfig,
type ResolvedPhysicsConfig,
} from './PhysicsTypes';
-import { handleWasmError } from '../wasmError';
+import { handleWasmError } from '../wasm/wasmError';
// Re-export the shapes consumers reach for via the plugin file so
// existing `import from './physics/PhysicsPlugin'` sites keep working.
diff --git a/sdk/src/physics/PhysicsRuntime.ts b/sdk/src/physics/PhysicsRuntime.ts
index 850262f5d..d380ff134 100644
--- a/sdk/src/physics/PhysicsRuntime.ts
+++ b/sdk/src/physics/PhysicsRuntime.ts
@@ -10,7 +10,7 @@
* state in the same way they read any other resource.
*/
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
import type { PhysicsWasmModule } from './PhysicsModuleLoader';
export interface PhysicsRuntimeData {
diff --git a/sdk/src/physics/PhysicsSystem.ts b/sdk/src/physics/PhysicsSystem.ts
index bf829de9d..cee8d5bfb 100644
--- a/sdk/src/physics/PhysicsSystem.ts
+++ b/sdk/src/physics/PhysicsSystem.ts
@@ -12,10 +12,10 @@
import type { App } from '../app';
import type { Entity } from '../types';
-import type { TransformData, ParentData, CanvasData } from '../component';
-import { Transform, Parent, Canvas } from '../component';
-import { Res, Time, type TimeData } from '../resource';
-import { Schedule, defineSystem } from '../system';
+import type { TransformData, ParentData, CanvasData } from '../ecs/component';
+import { Transform, Parent, Canvas } from '../ecs/component';
+import { Res, Time, type TimeData } from '../ecs/resource';
+import { Schedule, defineSystem } from '../ecs/system';
import { playModeOnly } from '../env';
import type { PhysicsWasmModule } from './PhysicsModuleLoader';
import { Physics } from './Physics';
@@ -40,8 +40,8 @@ import {
type CollisionHitEvent,
type SensorEvent,
} from './PhysicsTypes';
-import { withMalloc } from '../wasmScratch';
-import { engineApi, type EngineApi } from '../ecs/engineApi';
+import { withMalloc } from '../wasm/wasmScratch';
+import { engineApi, type EngineApi } from '../ecs/bridge/engineApi';
/**
* The engine surface this file drives. `getTransformPtr` is the web module's own
diff --git a/sdk/src/physics/PhysicsTypes.ts b/sdk/src/physics/PhysicsTypes.ts
index 4eaf3ffbb..aa361d0ef 100644
--- a/sdk/src/physics/PhysicsTypes.ts
+++ b/sdk/src/physics/PhysicsTypes.ts
@@ -9,7 +9,7 @@
*/
import type { Entity, Vec2 } from '../types';
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
// =============================================================================
// Plugin configuration
diff --git a/sdk/src/platform/native/hostBridge.ts b/sdk/src/platform/native/hostBridge.ts
index 9e5fd177c..00f199c76 100644
--- a/sdk/src/platform/native/hostBridge.ts
+++ b/sdk/src/platform/native/hostBridge.ts
@@ -19,7 +19,7 @@ import type {
} from './bridge';
import type { PlatformGlyph, PlatformGlyphRequest, PlatformRequestOptions } from '../types';
import { assertHostEnvironment } from './hostEnvironment';
-import { hasAudioBindings } from '../../ecs/nativeBindings';
+import { hasAudioBindings } from '../../ecs/bridge/nativeBindings';
/** Touch phases the host reports, matching the order it dispatches. */
const TOUCH_START = 0;
diff --git a/sdk/src/platform/native/hostEnvironment.ts b/sdk/src/platform/native/hostEnvironment.ts
index e4f9d9f70..d4aff3575 100644
--- a/sdk/src/platform/native/hostEnvironment.ts
+++ b/sdk/src/platform/native/hostEnvironment.ts
@@ -15,7 +15,7 @@
* missing global is named at the seam instead.
*/
-import { assertNativeBindings } from '../../ecs/nativeBindings';
+import { assertNativeBindings } from '../../ecs/bridge/nativeBindings';
/** A host global the SDK requires, and what breaks without it. */
interface RequiredGlobal {
diff --git a/sdk/src/pluginSets.ts b/sdk/src/pluginSets.ts
index 1167f0105..71b0d8dda 100644
--- a/sdk/src/pluginSets.ts
+++ b/sdk/src/pluginSets.ts
@@ -26,13 +26,13 @@ import { audioPlugin } from './audio';
import { videoPlugin } from './video';
import { particlePlugin } from './particle';
import { trailPlugin } from './trail';
-import { mesh2dPlugin } from './mesh2d';
+import { mesh2dPlugin } from './render/mesh2d';
import { tilemapPlugin } from './tilemap';
import { postProcessPlugin } from './postprocess';
import { timelinePlugin } from './timeline';
import { timerPlugin } from './timer';
import { velocityPlugin } from './velocity';
-import { lifecyclePlugin } from './lifecycle';
+import { lifecyclePlugin } from './ecs/lifecycle';
import { navPlugin, fsmPlugin, btPlugin, perceptionPlugin } from './ai';
import { eventBindingPlugin } from './eventBinding';
import { replicationPlugin } from './net/replication';
diff --git a/sdk/src/postprocess/PostProcessAPI.ts b/sdk/src/postprocess/PostProcessAPI.ts
index f714ad696..1ba3c2428 100644
--- a/sdk/src/postprocess/PostProcessAPI.ts
+++ b/sdk/src/postprocess/PostProcessAPI.ts
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { Entity } from '../types';
-import type { ShaderHandle } from '../material';
-import type { EngineApi } from '../ecs/engineApi';
-import { defineResource } from '../resource';
-import { handleWasmError } from '../wasmError';
-import { WasmBridge } from '../WasmBridge';
+import type { ShaderHandle } from '../render/material';
+import type { EngineApi } from '../ecs/bridge/engineApi';
+import { defineResource } from '../ecs/resource';
+import { handleWasmError } from '../wasm/wasmError';
+import { WasmBridge } from '../wasm/WasmBridge';
import { PostProcessStack, PostProcessState } from './PostProcessStack';
/**
diff --git a/sdk/src/postprocess/PostProcessPlugin.ts b/sdk/src/postprocess/PostProcessPlugin.ts
index 777ea90ea..41d0f5008 100644
--- a/sdk/src/postprocess/PostProcessPlugin.ts
+++ b/sdk/src/postprocess/PostProcessPlugin.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from '../app';
-import { Schedule } from '../system';
+import { Schedule } from '../ecs/system';
import { Assets } from '../asset/AssetPlugin';
import { PostProcess, PostProcessAPI } from './PostProcessAPI';
import { postProcessVolumeSystem, cleanupVolumeSystem, setVolumeTextureResolver, PostProcessVolumeConfigResource } from './volumeSystem';
diff --git a/sdk/src/postprocess/PostProcessStack.ts b/sdk/src/postprocess/PostProcessStack.ts
index d7d4341a9..6e0d2a8e6 100644
--- a/sdk/src/postprocess/PostProcessStack.ts
+++ b/sdk/src/postprocess/PostProcessStack.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { Entity } from '../types';
-import type { ShaderHandle, Vec4 } from '../material';
+import type { ShaderHandle, Vec4 } from '../render/material';
export interface PassConfig {
name: string;
diff --git a/sdk/src/postprocess/effects.ts b/sdk/src/postprocess/effects.ts
index d9c02d633..2402a6f99 100644
--- a/sdk/src/postprocess/effects.ts
+++ b/sdk/src/postprocess/effects.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import type { ShaderHandle } from '../material';
+import type { ShaderHandle } from '../render/material';
import { postProcessEffects } from './postProcessEffects';
export interface EffectUniformDef {
diff --git a/sdk/src/postprocess/postProcessEffects.ts b/sdk/src/postprocess/postProcessEffects.ts
index ee243166d..7f41e19b0 100644
--- a/sdk/src/postprocess/postProcessEffects.ts
+++ b/sdk/src/postprocess/postProcessEffects.ts
@@ -13,8 +13,8 @@
* resolution comes from the injected `u_viewport` (xy = pixels,
* zw = 1/pixels) instead of a per-pass upload.
*/
-import type { ShaderHandle } from '../material';
-import { Material } from '../material';
+import type { ShaderHandle } from '../render/material';
+import { Material } from '../render/material';
export const postProcessEffects = {
createLutGrade(): ShaderHandle {
diff --git a/sdk/src/postprocess/volumeBlending.ts b/sdk/src/postprocess/volumeBlending.ts
index c8de21743..a0492954a 100644
--- a/sdk/src/postprocess/volumeBlending.ts
+++ b/sdk/src/postprocess/volumeBlending.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import type { PostProcessVolumeData } from '../component';
+import type { PostProcessVolumeData } from '../ecs/component';
import { getEffectDef } from './effects';
export interface VolumeTransform {
diff --git a/sdk/src/postprocess/volumeSystem.ts b/sdk/src/postprocess/volumeSystem.ts
index b1638a1e8..0ce04187a 100644
--- a/sdk/src/postprocess/volumeSystem.ts
+++ b/sdk/src/postprocess/volumeSystem.ts
@@ -1,15 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { defineSystem } from '../system';
-import { defineResource, Res } from '../resource';
-import { Query } from '../query';
+import { defineSystem } from '../ecs/system';
+import { defineResource, Res } from '../ecs/resource';
+import { Query } from '../ecs/query';
import type { Entity } from '../types';
-import { PostProcessVolume, Transform, Camera, type PostProcessVolumeData, type TransformData, type CameraData } from '../component';
+import { PostProcessVolume, Transform, Camera, type PostProcessVolumeData, type TransformData, type CameraData } from '../ecs/component';
import { PostProcess, type PostProcessAPI } from './PostProcessAPI';
import { getEffectDef } from './effects';
import { blendVolumeEffects, computeVolumeFactor, type ActiveVolume, type VolumeTransform } from './volumeBlending';
-import type { ShaderHandle } from '../material';
-import { Material } from '../material';
+import type { ShaderHandle } from '../render/material';
+import { Material } from '../render/material';
export interface PostProcessVolumeConfig {
enabled: boolean;
diff --git a/sdk/src/prefab.ts b/sdk/src/prefab.ts
index 57fb78ef8..218b204f1 100644
--- a/sdk/src/prefab.ts
+++ b/sdk/src/prefab.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import type { World } from './world';
+import type { World } from './ecs/world';
import type { Entity } from './types';
import type { Assets } from './asset/Assets';
import { loadSceneWithAssets, SCENE_FORMAT_VERSION, type SceneData } from './scene';
diff --git a/sdk/src/prefab/diff.ts b/sdk/src/prefab/diff.ts
index e882af614..e4de93e82 100644
--- a/sdk/src/prefab/diff.ts
+++ b/sdk/src/prefab/diff.ts
@@ -7,7 +7,7 @@ import type {
PrefabOverride,
ProcessedEntity,
} from './types';
-import { getComponent } from '../component';
+import { getComponent } from '../ecs/component';
/**
* An entity-typed field on an instance holds a numeric runtime id; the source
diff --git a/sdk/src/prefab/entityRef.ts b/sdk/src/prefab/entityRef.ts
index 9990e8c12..abfad414e 100644
--- a/sdk/src/prefab/entityRef.ts
+++ b/sdk/src/prefab/entityRef.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { ComponentData, PrefabEntityId } from './types';
-import { getComponent } from '../component';
+import { getComponent } from '../ecs/component';
import { INVALID_ENTITY } from '../types';
/**
diff --git a/sdk/src/prefab/sceneInstance.ts b/sdk/src/prefab/sceneInstance.ts
index 9b47880d6..75e15d240 100644
--- a/sdk/src/prefab/sceneInstance.ts
+++ b/sdk/src/prefab/sceneInstance.ts
@@ -31,7 +31,7 @@ import { diffEntities } from './diff';
import type { DiffBaselineEntity } from './diff';
import { cloneComponents } from './clone';
import { applyOverridesToSource } from './override';
-import { getComponent } from '../component';
+import { getComponent } from '../ecs/component';
import { INVALID_ENTITY } from '../types';
import { PREFAB_FORMAT_VERSION } from './migrate';
import type {
diff --git a/sdk/src/prefab/validate.ts b/sdk/src/prefab/validate.ts
index 1c00bf713..24278ac8c 100644
--- a/sdk/src/prefab/validate.ts
+++ b/sdk/src/prefab/validate.ts
@@ -7,7 +7,7 @@ import type {
PrefabOverride,
} from './types';
import { PREFAB_ADDRESS_SEP } from './types';
-import { getComponent } from '../component';
+import { getComponent } from '../ecs/component';
export interface StaleOverride {
override: PrefabOverride;
diff --git a/sdk/src/prefabServer.ts b/sdk/src/prefabServer.ts
index 9858de21e..b7f256202 100644
--- a/sdk/src/prefabServer.ts
+++ b/sdk/src/prefabServer.ts
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from './app';
-import type { World } from './world';
+import type { World } from './ecs/world';
import type { Entity } from './types';
import type { Assets as AssetsClass } from './asset/Assets';
import { Assets } from './asset/AssetPlugin';
-import { defineResource } from './resource';
+import { defineResource } from './ecs/resource';
import {
instantiatePrefab,
type PrefabData,
diff --git a/sdk/src/preview/PreviewPlugin.ts b/sdk/src/preview/PreviewPlugin.ts
index 509eb4c7a..663f1d3f6 100644
--- a/sdk/src/preview/PreviewPlugin.ts
+++ b/sdk/src/preview/PreviewPlugin.ts
@@ -7,14 +7,14 @@
import type { App, Plugin } from '../app';
import type { SceneData } from '../scene';
-import { loadRuntimeScene } from '../runtimeLoader';
-import { Transform, Camera, Canvas, ProjectionType, ClearFlags, type TransformData, type CameraData, type CanvasData } from '../component';
+import { loadRuntimeScene } from '../runtime/runtimeLoader';
+import { Transform, Camera, Canvas, ProjectionType, ClearFlags, type TransformData, type CameraData, type CanvasData } from '../ecs/component';
import { DEFAULT_DESIGN_WIDTH, DEFAULT_DESIGN_HEIGHT } from '../defaults';
import { platformFetch } from '../platform';
import { SceneManager } from '../sceneManager';
import { HttpBackend } from '../asset/Backend';
import { fetchDecodePixels } from '../asset/imageDecode';
-import type { RuntimeAssetSource } from '../runtimeAssets';
+import type { RuntimeAssetSource } from '../runtime/runtimeAssets';
import { SpinePlugin } from '../spine/SpinePlugin';
import { log } from '../logger';
diff --git a/sdk/src/propertyPath.ts b/sdk/src/propertyPath.ts
index 8286f8ef8..6a9696387 100644
--- a/sdk/src/propertyPath.ts
+++ b/sdk/src/propertyPath.ts
@@ -14,9 +14,9 @@
* path would corrupt (see TimelineEvaluator). Merging them is a real change, not
* a rename.
*/
-import type { World } from './world';
+import type { World } from './ecs/world';
import type { Entity } from './types';
-import { getComponent } from './component';
+import { getComponent } from './ecs/component';
export function getNestedProperty(obj: Record<string, any>, path: string): unknown {
const parts = path.split('.');
diff --git a/sdk/src/blend.ts b/sdk/src/render/blend.ts
similarity index 100%
rename from sdk/src/blend.ts
rename to sdk/src/render/blend.ts
diff --git a/sdk/src/builtinShaders.ts b/sdk/src/render/builtinShaders.ts
similarity index 100%
rename from sdk/src/builtinShaders.ts
rename to sdk/src/render/builtinShaders.ts
diff --git a/sdk/src/cacheAsBitmap.ts b/sdk/src/render/cacheAsBitmap.ts
similarity index 95%
rename from sdk/src/cacheAsBitmap.ts
rename to sdk/src/render/cacheAsBitmap.ts
index c90f3f403..ed2806b84 100644
--- a/sdk/src/cacheAsBitmap.ts
+++ b/sdk/src/render/cacheAsBitmap.ts
@@ -5,7 +5,7 @@
* @brief CacheAsBitmap component for caching entity subtrees as bitmaps
*/
-import { defineComponent, type ComponentDef } from './component';
+import { defineComponent, type ComponentDef } from '../ecs/component';
import type { BitmapCache } from './cacheBitmap';
// =============================================================================
diff --git a/sdk/src/cacheBitmap.ts b/sdk/src/render/cacheBitmap.ts
similarity index 100%
rename from sdk/src/cacheBitmap.ts
rename to sdk/src/render/cacheBitmap.ts
diff --git a/sdk/src/customDraw.ts b/sdk/src/render/customDraw.ts
similarity index 100%
rename from sdk/src/customDraw.ts
rename to sdk/src/render/customDraw.ts
diff --git a/sdk/src/draw.ts b/sdk/src/render/draw.ts
similarity index 98%
rename from sdk/src/draw.ts
rename to sdk/src/render/draw.ts
index e7a2f189b..15fe98a08 100644
--- a/sdk/src/draw.ts
+++ b/sdk/src/render/draw.ts
@@ -7,15 +7,15 @@
* with automatic batching. All draw commands are cleared each frame.
*/
-import type { ESEngineModule } from './wasm';
-import type { Vec2, Color } from './types';
+import type { ESEngineModule } from '../wasm';
+import type { Vec2, Color } from '../types';
import type { GeometryHandle } from './geometry';
import type { ShaderHandle, MaterialHandle } from './material';
import { Material, isTextureRef, classifyUniformArity, type UniformValue, type TextureRef } from './material';
import { BlendMode } from './blend';
-import { CoreApiBridge } from './CoreApiBridge';
-import { handleWasmError } from './wasmError';
-import { log } from './logger';
+import { CoreApiBridge } from '../wasm/CoreApiBridge';
+import { handleWasmError } from '../wasm/wasmError';
+import { log } from '../logger';
export { BlendMode } from './blend';
diff --git a/sdk/src/filters.ts b/sdk/src/render/filters.ts
similarity index 100%
rename from sdk/src/filters.ts
rename to sdk/src/render/filters.ts
diff --git a/sdk/src/frameCapture.ts b/sdk/src/render/frameCapture.ts
similarity index 99%
rename from sdk/src/frameCapture.ts
rename to sdk/src/render/frameCapture.ts
index 6f891486d..20f42eb3e 100644
--- a/sdk/src/frameCapture.ts
+++ b/sdk/src/render/frameCapture.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import type { ESEngineModule } from './wasm';
+import type { ESEngineModule } from '../wasm';
import { awaitReadback, READBACK_READY } from './readback';
/**
diff --git a/sdk/src/geometry.ts b/sdk/src/render/geometry.ts
similarity index 98%
rename from sdk/src/geometry.ts
rename to sdk/src/render/geometry.ts
index 218d039a1..b3c5cb26a 100644
--- a/sdk/src/geometry.ts
+++ b/sdk/src/render/geometry.ts
@@ -7,8 +7,8 @@
* particles, trails, and other procedural meshes.
*/
-import type { ESEngineModule } from './wasm';
-import { CoreApiBridge } from './CoreApiBridge';
+import type { ESEngineModule } from '../wasm';
+import { CoreApiBridge } from '../wasm/CoreApiBridge';
// =============================================================================
// Types
diff --git a/sdk/src/glDebug.ts b/sdk/src/render/glDebug.ts
similarity index 90%
rename from sdk/src/glDebug.ts
rename to sdk/src/render/glDebug.ts
index 339ef16b8..880bcc0a7 100644
--- a/sdk/src/glDebug.ts
+++ b/sdk/src/render/glDebug.ts
@@ -5,8 +5,8 @@
* @brief GL error checking API for debugging rendering issues
*/
-import type { ESEngineModule } from './wasm';
-import { CoreApiBridge } from './CoreApiBridge';
+import type { ESEngineModule } from '../wasm';
+import { CoreApiBridge } from '../wasm/CoreApiBridge';
const bridge = new CoreApiBridge('glDebug');
let module: ESEngineModule | null = null;
diff --git a/sdk/src/graphics.ts b/sdk/src/render/graphics.ts
similarity index 99%
rename from sdk/src/graphics.ts
rename to sdk/src/render/graphics.ts
index c44b81fac..2581687c1 100644
--- a/sdk/src/graphics.ts
+++ b/sdk/src/render/graphics.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import type { Color, Vec2 } from './types';
+import type { Color, Vec2 } from '../types';
import { Draw } from './draw';
const DEFAULT_CURVE_SEGMENTS = 20;
diff --git a/sdk/src/material.ts b/sdk/src/render/material.ts
similarity index 98%
rename from sdk/src/material.ts
rename to sdk/src/render/material.ts
index 7589c00f6..237fb724d 100644
--- a/sdk/src/material.ts
+++ b/sdk/src/render/material.ts
@@ -6,15 +6,15 @@
* @details Provides shader creation and material management for custom visual effects.
*/
-import type { EngineApi } from './ecs/engineApi';
-import type { ESEngineModule } from './wasm';
-import { WasmBridge } from './WasmBridge';
-import { requireResourceManager } from './resourceManager';
+import type { EngineApi } from '../ecs/bridge/engineApi';
+import type { ESEngineModule } from '../wasm';
+import { WasmBridge } from '../wasm/WasmBridge';
+import { requireResourceManager } from '../wasm/resourceManager';
import { awaitReadback, READBACK_READY } from './readback';
-import type { Vec2, Vec3, Vec4 } from './types';
+import type { Vec2, Vec3, Vec4 } from '../types';
import { BlendMode } from './blend';
-export type { Vec2, Vec3, Vec4 } from './types';
+export type { Vec2, Vec3, Vec4 } from '../types';
// =============================================================================
// Types
diff --git a/sdk/src/materialGraph.ts b/sdk/src/render/materialGraph.ts
similarity index 100%
rename from sdk/src/materialGraph.ts
rename to sdk/src/render/materialGraph.ts
diff --git a/sdk/src/mesh2d.ts b/sdk/src/render/mesh2d.ts
similarity index 92%
rename from sdk/src/mesh2d.ts
rename to sdk/src/render/mesh2d.ts
index 25f985857..4121cd6dc 100644
--- a/sdk/src/mesh2d.ts
+++ b/sdk/src/render/mesh2d.ts
@@ -5,15 +5,15 @@
* engine (mesh2d_setGeometry) and carries it through scene save/load as an
* out-of-band field (variable-size payloads are not C++ component fields).
*/
-import type { App, Plugin } from './app';
-import type { Entity } from './types';
-import type { CppRegistry } from './wasm';
-import type { EngineApi } from './ecs/engineApi';
-import { engineApi } from './ecs/engineApi';
-import type { Mesh2DGeometry } from './component';
-import { defineResource } from './resource';
-import { registerSceneComponentCodec } from './scene';
-import { withScratch } from './wasmScratch';
+import type { App, Plugin } from '../app';
+import type { Entity } from '../types';
+import type { CppRegistry } from '../wasm';
+import type { EngineApi } from '../ecs/bridge/engineApi';
+import { engineApi } from '../ecs/bridge/engineApi';
+import type { Mesh2DGeometry } from '../ecs/component';
+import { defineResource } from '../ecs/resource';
+import { registerSceneComponentCodec } from '../scene';
+import { withScratch } from '../wasm/wasmScratch';
function packRgba(colors: number[], v: number): number {
const clamp = (x: number) => Math.max(0, Math.min(255, Math.round(x * 255)));
diff --git a/sdk/src/readback.ts b/sdk/src/render/readback.ts
similarity index 100%
rename from sdk/src/readback.ts
rename to sdk/src/render/readback.ts
diff --git a/sdk/src/renderPipeline.ts b/sdk/src/render/renderPipeline.ts
similarity index 97%
rename from sdk/src/renderPipeline.ts
rename to sdk/src/render/renderPipeline.ts
index d0d953f0f..d92515939 100644
--- a/sdk/src/renderPipeline.ts
+++ b/sdk/src/render/renderPipeline.ts
@@ -5,10 +5,10 @@
* @brief Unified render pipeline for runtime and editor
*/
-import type { CppRegistry } from './wasm';
-import type { Entity } from './types';
+import type { CppRegistry } from '../wasm';
+import type { Entity } from '../types';
import { Renderer } from './renderer';
-import type { PostProcessAPI } from './postprocess';
+import type { PostProcessAPI } from '../postprocess';
import { Draw } from './draw';
import {
getDrawCallbacks,
@@ -16,7 +16,7 @@ import {
getPreSceneDrawCallbacks,
unregisterPreSceneDrawCallback,
} from './customDraw';
-import { log } from './logger';
+import { log } from '../logger';
export interface Viewport {
x: number;
diff --git a/sdk/src/renderTexture.ts b/sdk/src/render/renderTexture.ts
similarity index 97%
rename from sdk/src/renderTexture.ts
rename to sdk/src/render/renderTexture.ts
index 9a84152fb..2ba490772 100644
--- a/sdk/src/renderTexture.ts
+++ b/sdk/src/render/renderTexture.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { Renderer, type RenderTargetHandle } from './renderer';
-import { getResourceManager } from './resourceManager';
+import { getResourceManager } from '../wasm/resourceManager';
export interface RenderTextureOptions {
width: number;
diff --git a/sdk/src/renderer.ts b/sdk/src/render/renderer.ts
similarity index 97%
rename from sdk/src/renderer.ts
rename to sdk/src/render/renderer.ts
index dc12f98b5..7499a4321 100644
--- a/sdk/src/renderer.ts
+++ b/sdk/src/render/renderer.ts
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import type { ESEngineModule, CppRegistry } from './wasm';
-import { CoreApiBridge } from './CoreApiBridge';
-import { handleWasmError } from './wasmError';
-import { requireResourceManager } from './resourceManager';
+import type { ESEngineModule, CppRegistry } from '../wasm';
+import { CoreApiBridge } from '../wasm/CoreApiBridge';
+import { handleWasmError } from '../wasm/wasmError';
+import { requireResourceManager } from '../wasm/resourceManager';
import { decodeFrameCapture, replayToDrawCall as replayToDrawCallImpl, getSnapshotImageData as getSnapshotImpl, type FrameCaptureData } from './frameCapture';
export enum RenderStage {
diff --git a/sdk/src/spriteFilter.ts b/sdk/src/render/spriteFilter.ts
similarity index 100%
rename from sdk/src/spriteFilter.ts
rename to sdk/src/render/spriteFilter.ts
diff --git a/sdk/src/textureParams.ts b/sdk/src/render/textureParams.ts
similarity index 96%
rename from sdk/src/textureParams.ts
rename to sdk/src/render/textureParams.ts
index cce17658b..4ac495a54 100644
--- a/sdk/src/textureParams.ts
+++ b/sdk/src/render/textureParams.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { Renderer } from './renderer';
-import { requireResourceManager } from './resourceManager';
+import { requireResourceManager } from '../wasm/resourceManager';
export const TextureFilter = {
Nearest: 0,
diff --git a/sdk/src/miniGameRuntime.ts b/sdk/src/runtime/miniGameRuntime.ts
similarity index 95%
rename from sdk/src/miniGameRuntime.ts
rename to sdk/src/runtime/miniGameRuntime.ts
index 510be9859..df0a8f362 100644
--- a/sdk/src/miniGameRuntime.ts
+++ b/sdk/src/runtime/miniGameRuntime.ts
@@ -15,18 +15,18 @@
*/
import { createWebApp } from './webAppFactory';
-import type { ESEngineModule } from './wasm';
-import type { AudioProjectConfig } from './audio/AudioProjectConfig';
+import type { ESEngineModule } from '../wasm';
+import type { AudioProjectConfig } from '../audio/AudioProjectConfig';
import { initRuntime } from './runtimeLoader';
-import type { ThemeOverrides } from './ui';
-import { applyBuildRuntimeConfig, type RuntimeBuildConfig } from './defaults';
-import { getPlatform, platformReadTextFile, platformInstantiateWasm } from './platform';
-import { MiniGamePlatformAdapter } from './platform/minigame';
+import type { ThemeOverrides } from '../ui';
+import { applyBuildRuntimeConfig, type RuntimeBuildConfig } from '../defaults';
+import { getPlatform, platformReadTextFile, platformInstantiateWasm } from '../platform';
+import { MiniGamePlatformAdapter } from '../platform/minigame';
import { loadPackagedAssetIndex, createPackagedAssetSource, applyAssetRefResolvers } from './packagedRuntime';
-import { createMiniGameSideModuleHost, type MiniGameSideModuleFactories } from './sideModules';
-import type { Vec2 } from './types';
-import type { SceneData } from './scene';
-import { log } from './logger';
+import { createMiniGameSideModuleHost, type MiniGameSideModuleFactories } from '../sideModules';
+import type { Vec2 } from '../types';
+import type { SceneData } from '../scene';
+import { log } from '../logger';
// =============================================================================
// Emscripten WASM Instantiation
diff --git a/sdk/src/nativeGameRuntime.ts b/sdk/src/runtime/nativeGameRuntime.ts
similarity index 90%
rename from sdk/src/nativeGameRuntime.ts
rename to sdk/src/runtime/nativeGameRuntime.ts
index c27151e54..6582f8be3 100644
--- a/sdk/src/nativeGameRuntime.ts
+++ b/sdk/src/runtime/nativeGameRuntime.ts
@@ -15,16 +15,16 @@
* before the async boot settles).
*/
-import type { App } from './app';
+import type { App } from '../app';
import { initRuntime } from './runtimeLoader';
-import { createNativeApp } from './ecs/nativeRuntime';
-import type { NativeBridge } from './platform/native';
-import { platformReadTextFile } from './platform';
+import { createNativeApp } from '../ecs/bridge/nativeRuntime';
+import type { NativeBridge } from '../platform/native';
+import { platformReadTextFile } from '../platform';
import { loadPackagedAssetIndex, createPackagedAssetSource, applyAssetRefResolvers, type PackagedGameConfig } from './packagedRuntime';
-import type { SceneData } from './scene';
-import type { ThemeOverrides } from './ui';
-import { parseThemeOverrides } from './ui';
-import { log } from './logger';
+import type { SceneData } from '../scene';
+import type { ThemeOverrides } from '../ui';
+import { parseThemeOverrides } from '../ui';
+import { log } from '../logger';
export interface NativeGameOptions {
/** The host's capability bridge (packaged files, image decode, input). */
diff --git a/sdk/src/packagedRuntime.ts b/sdk/src/runtime/packagedRuntime.ts
similarity index 94%
rename from sdk/src/packagedRuntime.ts
rename to sdk/src/runtime/packagedRuntime.ts
index 1974739f4..e35475cb5 100644
--- a/sdk/src/packagedRuntime.ts
+++ b/sdk/src/runtime/packagedRuntime.ts
@@ -12,16 +12,16 @@
* the bytes arrive, so the same code serves both realms.
*/
-import { toBuildPath } from './assetTypes';
-import { extractUuid } from './asset/AssetRegistry';
-import { platformReadTextFile, platformLoadImagePixels } from './platform';
-import { ManifestModel, type AddressableManifest } from './asset/AddressableManifest';
-import { Catalog, atlasCatalogFields, type CatalogEntry } from './asset/Catalog';
-import { FileSystemBackend, type Backend } from './asset/Backend';
-import type { ParsedTextureImportSettings } from './asset/textureImportSettings';
-import { Audio } from './audio/Audio';
-import { VideoPlayer } from './video/VideoAPI';
-import type { App } from './app';
+import { toBuildPath } from '../assetTypes';
+import { extractUuid } from '../asset/AssetRegistry';
+import { platformReadTextFile, platformLoadImagePixels } from '../platform';
+import { ManifestModel, type AddressableManifest } from '../asset/AddressableManifest';
+import { Catalog, atlasCatalogFields, type CatalogEntry } from '../asset/Catalog';
+import { FileSystemBackend, type Backend } from '../asset/Backend';
+import type { ParsedTextureImportSettings } from '../asset/textureImportSettings';
+import { Audio } from '../audio/Audio';
+import { VideoPlayer } from '../video/VideoAPI';
+import type { App } from '../app';
import type { RuntimeAssetSource } from './runtimeAssets';
/**
diff --git a/sdk/src/playRealmRuntime.ts b/sdk/src/runtime/playRealmRuntime.ts
similarity index 93%
rename from sdk/src/playRealmRuntime.ts
rename to sdk/src/runtime/playRealmRuntime.ts
index 731d8c6e5..3584d4275 100644
--- a/sdk/src/playRealmRuntime.ts
+++ b/sdk/src/runtime/playRealmRuntime.ts
@@ -15,22 +15,22 @@
* so its defineComponent/defineSystem populate the registry this drains. This
* entry only owns the runtime + snapshot + asset fetch.
*/
-import type { App } from './app';
-import type { ESEngineModule } from './wasm';
-import { Audio } from './audio/Audio';
-import { VideoPlayer } from './video/VideoAPI';
+import type { App } from '../app';
+import type { ESEngineModule } from '../wasm';
+import { Audio } from '../audio/Audio';
+import { VideoPlayer } from '../video/VideoAPI';
import { initRuntime } from './runtimeLoader';
-import type { ThemeOverrides } from './ui';
+import type { ThemeOverrides } from '../ui';
import type { RuntimeAssetSource } from './runtimeAssets';
-import { HttpBackend } from './asset/Backend';
-import { Catalog, type CatalogData } from './asset/Catalog';
-import { ManifestModel, type AddressableManifest } from './asset/AddressableManifest';
-import type { SceneData } from './scene';
-import type { PhysicsPluginConfig } from './physics/PhysicsPlugin';
-import type { AudioProjectConfig } from './audio/AudioProjectConfig';
-import { fetchDecodePixels } from './asset/imageDecode';
+import { HttpBackend } from '../asset/Backend';
+import { Catalog, type CatalogData } from '../asset/Catalog';
+import { ManifestModel, type AddressableManifest } from '../asset/AddressableManifest';
+import type { SceneData } from '../scene';
+import type { PhysicsPluginConfig } from '../physics/PhysicsPlugin';
+import type { AudioProjectConfig } from '../audio/AudioProjectConfig';
+import { fetchDecodePixels } from '../asset/imageDecode';
import { applyAssetRefResolvers } from './packagedRuntime';
-import { extractUuid, UUID_REF_PREFIX } from './asset/AssetRegistry';
+import { extractUuid, UUID_REF_PREFIX } from '../asset/AssetRegistry';
export interface PlayRealmRuntimeConfig {
app: App;
diff --git a/sdk/src/playableCta.ts b/sdk/src/runtime/playableCta.ts
similarity index 100%
rename from sdk/src/playableCta.ts
rename to sdk/src/runtime/playableCta.ts
diff --git a/sdk/src/playableRuntime.ts b/sdk/src/runtime/playableRuntime.ts
similarity index 92%
rename from sdk/src/playableRuntime.ts
rename to sdk/src/runtime/playableRuntime.ts
index 17a59fdb8..29d31cc01 100644
--- a/sdk/src/playableRuntime.ts
+++ b/sdk/src/runtime/playableRuntime.ts
@@ -10,18 +10,18 @@
* self-gate off `app.sideModules` exactly as in every other realm. This
* entry only owns the embedded asset source + the runtime boot.
*/
-import type { App } from './app';
-import type { ESEngineModule } from './wasm';
-import type { AudioProjectConfig } from './audio/AudioProjectConfig';
+import type { App } from '../app';
+import type { ESEngineModule } from '../wasm';
+import type { AudioProjectConfig } from '../audio/AudioProjectConfig';
import { initRuntime } from './runtimeLoader';
-import type { ThemeOverrides } from './ui';
+import type { ThemeOverrides } from '../ui';
import type { RuntimeAssetSource } from './runtimeAssets';
-import { EmbeddedBackend } from './asset/Backend';
-import { ManifestModel, type AddressableManifest } from './asset/AddressableManifest';
-import type { Vec2 } from './types';
-import type { SceneData } from './scene';
-import { Audio } from './audio/Audio';
-import { VideoPlayer } from './video/VideoAPI';
+import { EmbeddedBackend } from '../asset/Backend';
+import { ManifestModel, type AddressableManifest } from '../asset/AddressableManifest';
+import type { Vec2 } from '../types';
+import type { SceneData } from '../scene';
+import { Audio } from '../audio/Audio';
+import { VideoPlayer } from '../video/VideoAPI';
export interface PlayableRuntimeConfig {
app: App;
diff --git a/sdk/src/runtimeAssets.ts b/sdk/src/runtime/runtimeAssets.ts
similarity index 94%
rename from sdk/src/runtimeAssets.ts
rename to sdk/src/runtime/runtimeAssets.ts
index 5ebc44549..94af3e64a 100644
--- a/sdk/src/runtimeAssets.ts
+++ b/sdk/src/runtime/runtimeAssets.ts
@@ -7,14 +7,14 @@
* builder runtime loader and the spine scene loader (and any editor that
* drives the same load path). Kept in its own module so neither the
* runtime loader nor the spine loader has to import the other.
-import { linearColorSpace } from './env';
+import { linearColorSpace } from '../env';
*/
-import type { ESEngineModule } from './wasm';
-import { linearColorSpace } from './env';
-import type { Backend } from './asset/Backend';
-import type { ParsedTextureImportSettings } from './asset/textureImportSettings';
-import { requireResourceManager } from './resourceManager';
-import { withMalloc } from './wasmScratch';
+import type { ESEngineModule } from '../wasm';
+import { linearColorSpace } from '../env';
+import type { Backend } from '../asset/Backend';
+import type { ParsedTextureImportSettings } from '../asset/textureImportSettings';
+import { requireResourceManager } from '../wasm/resourceManager';
+import { withMalloc } from '../wasm/wasmScratch';
/**
* How a target supplies scene assets to the single `Assets` channel, built from
diff --git a/sdk/src/runtimeLoader.ts b/sdk/src/runtime/runtimeLoader.ts
similarity index 92%
rename from sdk/src/runtimeLoader.ts
rename to sdk/src/runtime/runtimeLoader.ts
index 83eb66c6a..ef6c92d85 100644
--- a/sdk/src/runtimeLoader.ts
+++ b/sdk/src/runtime/runtimeLoader.ts
@@ -5,43 +5,43 @@
* @brief Runtime scene loader for builder targets (WeChat, Playable, etc.)
*/
-import { SceneOwner } from './component';
-import { loadSceneData, updateCameraAspectRatio, sceneHasPrefabEntries, expandScenePrefabs, type SceneData } from './scene';
-import type { PrefabData } from './prefab/types';
-import { switchTheme, resolveThemeTokens, type ThemeOverrides } from './ui';
-import { discoverSceneAssets } from './asset/discoverAssets';
-import type { ESEngineModule } from './wasm';
-import type { SpineWasmModule } from './spine/SpineModuleLoader';
-import { SpineManager } from './spine/SpineManager';
-import type { PhysicsWasmModule } from './physics/PhysicsModuleLoader';
-import { PhysicsPlugin, type PhysicsPluginConfig } from './physics/PhysicsPlugin';
-import { applyAudioProjectConfig, type AudioProjectConfig } from './audio/AudioProjectConfig';
-import { SpinePlugin } from './spine/SpinePlugin';
-import type { App } from './app';
-import { Assets as AssetsClass } from './asset/Assets';
-import { Assets as AssetsResource } from './asset/AssetPlugin';
-import { transcoderFromModule, type BasisWasmModule } from './asset/basisTranscoder';
-import type { BasisTranscoder } from './asset/compressed';
-import type { TextureImportSettings } from './asset/loaders/TextureLoader';
-import { SceneManager, type SceneConfig } from './sceneManager';
-import { DEFAULT_GRAVITY, DEFAULT_FIXED_TIMESTEP } from './defaults';
-import { SpriteAnimation } from './animation/SpriteAnimator';
-import { Audio } from './audio/Audio';
-import { VideoPlayer } from './video/VideoAPI';
-import { Localization, matchLocale } from './i18n/Localization';
-import { LocalizationPlugin } from './i18n/LocalizationPlugin';
-import { platformLanguage } from './platform';
-import { flushPendingSystems } from './app';
-import { installHotUpdateRebind } from './hotUpdateRebind';
-import { requireResourceManager } from './resourceManager';
-import { log } from './logger';
+import { SceneOwner } from '../ecs/component';
+import { loadSceneData, updateCameraAspectRatio, sceneHasPrefabEntries, expandScenePrefabs, type SceneData } from '../scene';
+import type { PrefabData } from '../prefab/types';
+import { switchTheme, resolveThemeTokens, type ThemeOverrides } from '../ui';
+import { discoverSceneAssets } from '../asset/discoverAssets';
+import type { ESEngineModule } from '../wasm';
+import type { SpineWasmModule } from '../spine/SpineModuleLoader';
+import { SpineManager } from '../spine/SpineManager';
+import type { PhysicsWasmModule } from '../physics/PhysicsModuleLoader';
+import { PhysicsPlugin, type PhysicsPluginConfig } from '../physics/PhysicsPlugin';
+import { applyAudioProjectConfig, type AudioProjectConfig } from '../audio/AudioProjectConfig';
+import { SpinePlugin } from '../spine/SpinePlugin';
+import type { App } from '../app';
+import { Assets as AssetsClass } from '../asset/Assets';
+import { Assets as AssetsResource } from '../asset/AssetPlugin';
+import { transcoderFromModule, type BasisWasmModule } from '../asset/basisTranscoder';
+import type { BasisTranscoder } from '../asset/compressed';
+import type { TextureImportSettings } from '../asset/loaders/TextureLoader';
+import { SceneManager, type SceneConfig } from '../sceneManager';
+import { DEFAULT_GRAVITY, DEFAULT_FIXED_TIMESTEP } from '../defaults';
+import { SpriteAnimation } from '../animation/SpriteAnimator';
+import { Audio } from '../audio/Audio';
+import { VideoPlayer } from '../video/VideoAPI';
+import { Localization, matchLocale } from '../i18n/Localization';
+import { LocalizationPlugin } from '../i18n/LocalizationPlugin';
+import { platformLanguage } from '../platform';
+import { flushPendingSystems } from '../app';
+import { installHotUpdateRebind } from '../hotUpdateRebind';
+import { requireResourceManager } from '../wasm/resourceManager';
+import { log } from '../logger';
import { type RuntimeAssetSource, type TextureParams } from './runtimeAssets';
-import { loadSpineAssets, applySpineEntities, type SpineAssetInfo } from './spine/loadSpineScene';
-import { DragonBonesPlugin } from './dragonbones/DragonBonesPlugin';
-import type { DragonBonesManager } from './dragonbones/DragonBonesManager';
-import { loadDragonBonesAssets, applyDragonBonesEntities, type DragonBonesAssetInfo } from './dragonbones/loadDragonBonesScene';
-import type { AddressableManifest, ManifestModel } from './asset/AddressableManifest';
-import type { Catalog } from './asset/Catalog';
+import { loadSpineAssets, applySpineEntities, type SpineAssetInfo } from '../spine/loadSpineScene';
+import { DragonBonesPlugin } from '../dragonbones/DragonBonesPlugin';
+import type { DragonBonesManager } from '../dragonbones/DragonBonesManager';
+import { loadDragonBonesAssets, applyDragonBonesEntities, type DragonBonesAssetInfo } from '../dragonbones/loadDragonBonesScene';
+import type { AddressableManifest, ManifestModel } from '../asset/AddressableManifest';
+import type { Catalog } from '../asset/Catalog';
// =============================================================================
// Public Interface
diff --git a/sdk/src/webAppFactory.ts b/sdk/src/runtime/webAppFactory.ts
similarity index 89%
rename from sdk/src/webAppFactory.ts
rename to sdk/src/runtime/webAppFactory.ts
index 2dd442e99..6d3939b06 100644
--- a/sdk/src/webAppFactory.ts
+++ b/sdk/src/runtime/webAppFactory.ts
@@ -1,16 +1,16 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { App, createWebApp as _createWebApp, type Plugin, type WebAppOptions } from './app';
-import type { CppRegistry, ESEngineModule } from './wasm';
-import { assetPlugin } from './asset';
-import { prefabsPlugin } from './prefabServer';
-import { sceneManagerPlugin } from './scenePlugin';
-import { seedEngineComponents } from './component';
-import { uiPlugins } from './uiPlugins';
-import { simulationBasePlugins, webBasePlugins } from './pluginSets';
-import { SpinePlugin } from './spine';
-import { DragonBonesPlugin } from './dragonbones';
-import { createFetchSideModuleHost, type SideModuleHost } from './sideModules';
+import { App, createWebApp as _createWebApp, type Plugin, type WebAppOptions } from '../app';
+import type { CppRegistry, ESEngineModule } from '../wasm';
+import { assetPlugin } from '../asset';
+import { prefabsPlugin } from '../prefabServer';
+import { sceneManagerPlugin } from '../scenePlugin';
+import { seedEngineComponents } from '../ecs/component';
+import { uiPlugins } from '../uiPlugins';
+import { simulationBasePlugins, webBasePlugins } from '../pluginSets';
+import { SpinePlugin } from '../spine';
+import { DragonBonesPlugin } from '../dragonbones';
+import { createFetchSideModuleHost, type SideModuleHost } from '../sideModules';
export interface CreateWebAppOptions extends WebAppOptions {
diff --git a/sdk/src/wechatRuntime.ts b/sdk/src/runtime/wechatRuntime.ts
similarity index 100%
rename from sdk/src/wechatRuntime.ts
rename to sdk/src/runtime/wechatRuntime.ts
diff --git a/sdk/src/scene.ts b/sdk/src/scene.ts
index 336a58cf6..219340865 100644
--- a/sdk/src/scene.ts
+++ b/sdk/src/scene.ts
@@ -5,12 +5,12 @@
* @brief Scene loading utilities
*/
-import { World } from './world';
+import { World } from './ecs/world';
import { Entity, INVALID_ENTITY } from './types';
-import { getComponent, Name, Camera, RuntimeOnly } from './component';
+import { getComponent, Name, Camera, RuntimeOnly } from './ecs/component';
import { deepClone } from './deepClone';
import { discoverSceneAssets } from './asset/discoverAssets';
-import { requireResourceManager } from './resourceManager';
+import { requireResourceManager } from './wasm/resourceManager';
import { validateComponentData, formatValidationErrors, assetFieldNames } from './validation';
import { log } from './logger';
import { ESTELLA_SCENE_GENERATOR } from './provenance';
diff --git a/sdk/src/scene/SceneTransitionController.ts b/sdk/src/scene/SceneTransitionController.ts
index 458a404b4..8136b04de 100644
--- a/sdk/src/scene/SceneTransitionController.ts
+++ b/sdk/src/scene/SceneTransitionController.ts
@@ -10,8 +10,8 @@
* of this controller and drives it from `updateTransition()`.
*/
import type { Color } from '../types';
-import { registerDrawCallback, unregisterDrawCallback } from '../customDraw';
-import { Draw } from '../draw';
+import { registerDrawCallback, unregisterDrawCallback } from '../render/customDraw';
+import { Draw } from '../render/draw';
import { log } from '../logger';
export interface FadeTransitionOptions {
diff --git a/sdk/src/sceneManager.ts b/sdk/src/sceneManager.ts
index f910750ec..792d3a459 100644
--- a/sdk/src/sceneManager.ts
+++ b/sdk/src/sceneManager.ts
@@ -9,20 +9,20 @@ import type { App } from './app';
import type { Entity, Color } from './types';
import type { SceneData, SceneLoadOptions, LoadedSceneAssets, SceneLoadProgressCallback } from './scene';
import { discoverSceneAssets } from './asset/discoverAssets';
-import type { SystemDef } from './system';
-import { Material } from './material';
-import type { DrawCallback } from './customDraw';
-import { Schedule } from './system';
+import type { SystemDef } from './ecs/system';
+import { Material } from './render/material';
+import type { DrawCallback } from './render/customDraw';
+import { Schedule } from './ecs/system';
import { loadSceneWithAssets } from './scene';
-import { registerDrawCallback, unregisterDrawCallback } from './customDraw';
+import { registerDrawCallback, unregisterDrawCallback } from './render/customDraw';
import { PostProcess, PostProcessStack } from './postprocess';
-import { defineResource } from './resource';
+import { defineResource } from './ecs/resource';
import { SceneTransitionController } from './scene/SceneTransitionController';
import {
SceneOwner, Disabled, Sprite, SpineAnimation, BitmapText,
ShapeRenderer, ParticleEmitter,
type AnyComponentDef,
-} from './component';
+} from './ecs/component';
import { UIVisual } from './ui/core/ui-visual';
import { Assets } from './asset/AssetPlugin';
import { RuntimeConfig } from './defaults';
diff --git a/sdk/src/scenePlugin.ts b/sdk/src/scenePlugin.ts
index d8e5b121c..4acf73adc 100644
--- a/sdk/src/scenePlugin.ts
+++ b/sdk/src/scenePlugin.ts
@@ -8,12 +8,12 @@
import type { App, Plugin } from './app';
import { SceneManager, SceneManagerState } from './sceneManager';
import { SceneStreaming, SceneStreamingController } from './sceneStreaming';
-import { defineSystem, Schedule, GetWorld } from './system';
-import { Res, ResMut, Time } from './resource';
-import { Transform, type TransformData } from './component';
+import { defineSystem, Schedule, GetWorld } from './ecs/system';
+import { Res, ResMut, Time } from './ecs/resource';
+import { Transform, type TransformData } from './ecs/component';
import { playModeOnly } from './env';
-import type { SystemDef } from './system';
-import type { World } from './world';
+import type { SystemDef } from './ecs/system';
+import type { World } from './ecs/world';
import { log } from './logger';
const sceneTransitionSystem = defineSystem(
diff --git a/sdk/src/sceneStreaming.ts b/sdk/src/sceneStreaming.ts
index dd3b9e31d..8128a7729 100644
--- a/sdk/src/sceneStreaming.ts
+++ b/sdk/src/sceneStreaming.ts
@@ -11,7 +11,7 @@
* thrash. This is pure orchestration — it owns no loading itself, only calls the
* existing `loadAdditive`/`unload`/`sleep`/`wake` primitives.
*/
-import { defineResource } from './resource';
+import { defineResource } from './ecs/resource';
import type { Entity } from './types';
/** A streamable cell: an additive scene with a world-space center + radius. */
diff --git a/sdk/src/screen.ts b/sdk/src/screen.ts
index 32abb29f0..bd2cf216a 100644
--- a/sdk/src/screen.ts
+++ b/sdk/src/screen.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { Emitter } from './emitter';
+import { Emitter } from './ecs/emitter';
export enum ScreenOrientation {
Portrait = 'portrait',
diff --git a/sdk/src/skeletal/meshBatches.ts b/sdk/src/skeletal/meshBatches.ts
index 5aab03955..ee8e3ed45 100644
--- a/sdk/src/skeletal/meshBatches.ts
+++ b/sdk/src/skeletal/meshBatches.ts
@@ -15,7 +15,7 @@
* those bytes straight into its own heap, and nothing allocates a typed
* array per batch per frame.
*/
-import { withMalloc, withScratch } from '../wasmScratch';
+import { withMalloc, withScratch } from '../wasm/wasmScratch';
/** The heap a module marshals through. */
export interface SkeletalHeap {
diff --git a/sdk/src/skeletal/submitMeshes.ts b/sdk/src/skeletal/submitMeshes.ts
index d34f618dc..1d9d55bbf 100644
--- a/sdk/src/skeletal/submitMeshes.ts
+++ b/sdk/src/skeletal/submitMeshes.ts
@@ -14,7 +14,7 @@
* live. Nothing intermediate is allocated, and nothing is cached between
* frames.
*/
-import { withScratch } from '../wasmScratch';
+import { withScratch } from '../wasm/wasmScratch';
import type { Entity } from '../types';
import type { MeshBatchVisitor } from './meshBatches';
diff --git a/sdk/src/spine/ModuleBackend.ts b/sdk/src/spine/ModuleBackend.ts
index 2adca86f3..4fbc314f0 100644
--- a/sdk/src/spine/ModuleBackend.ts
+++ b/sdk/src/spine/ModuleBackend.ts
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { Entity } from '../types';
import type { CppRegistry } from '../wasm';
-import type { EngineApi } from '../ecs/engineApi';
+import type { EngineApi } from '../ecs/bridge/engineApi';
import type { SpineModuleController } from './SpineController';
import type { RawSpineEvent, ConstraintList, TransformMixData, PathMixData } from './SpineController';
import { log } from '../logger';
diff --git a/sdk/src/spine/SpineBridge.ts b/sdk/src/spine/SpineBridge.ts
index 29d23dbb2..041ef552a 100644
--- a/sdk/src/spine/SpineBridge.ts
+++ b/sdk/src/spine/SpineBridge.ts
@@ -10,7 +10,7 @@
* in the core module any more — spine is fully side-module.)
*/
-import { WasmBridge } from '../WasmBridge';
+import { WasmBridge } from '../wasm/WasmBridge';
import type { SpineWrappedAPI } from './SpineModuleLoader';
/**
diff --git a/sdk/src/spine/SpineController.ts b/sdk/src/spine/SpineController.ts
index 2ed8cb9af..865c15087 100644
--- a/sdk/src/spine/SpineController.ts
+++ b/sdk/src/spine/SpineController.ts
@@ -9,7 +9,7 @@ import type { Entity, Vec2 } from '../types';
import type { SpineWasmModule, SpineWrappedAPI } from './SpineModuleLoader';
import { SpineModuleBridge } from './SpineBridge';
import { log } from '../logger';
-import { withMalloc, withScratch } from '../wasmScratch';
+import { withMalloc, withScratch } from '../wasm/wasmScratch';
import { forEachMeshBatch, type MeshBatchVisitor } from '../skeletal/meshBatches';
export type SpineEventType = 'start' | 'interrupt' | 'end' | 'complete' | 'dispose' | 'event';
diff --git a/sdk/src/spine/SpineManager.ts b/sdk/src/spine/SpineManager.ts
index 0970ba0a9..06073cb4e 100644
--- a/sdk/src/spine/SpineManager.ts
+++ b/sdk/src/spine/SpineManager.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import type { EngineApi } from '../ecs/engineApi';
+import type { EngineApi } from '../ecs/bridge/engineApi';
import type { ESEngineModule, CppRegistry } from '../wasm';
import type { Entity } from '../types';
import type { RawSpineEvent, ConstraintList, TransformMixData, PathMixData } from './SpineController';
diff --git a/sdk/src/spine/SpinePlugin.ts b/sdk/src/spine/SpinePlugin.ts
index 02f9ada7a..1fcdb81cb 100644
--- a/sdk/src/spine/SpinePlugin.ts
+++ b/sdk/src/spine/SpinePlugin.ts
@@ -2,14 +2,14 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { Plugin } from '../app';
import type { App } from '../app';
-import { defineResource, Time } from '../resource';
-import { Schedule } from '../system';
-import type { SystemDef } from '../system';
+import { defineResource, Time } from '../ecs/resource';
+import { Schedule } from '../ecs/system';
+import type { SystemDef } from '../ecs/system';
import type { Entity } from '../types';
import { SpineManager, type SpineVersion } from './SpineManager';
import type { SpineModuleFactory, SpineWasmModule } from './SpineModuleLoader';
import { SPINE_VERSIONS, spineModuleId } from '../sideModules';
-import { engineApi } from '../ecs/engineApi';
+import { engineApi } from '../ecs/bridge/engineApi';
import { AnimatorController } from '../animation/Animator';
export type SpineEventType = 'start' | 'interrupt' | 'end' | 'complete' | 'event';
diff --git a/sdk/src/spine/index.ts b/sdk/src/spine/index.ts
index f569811de..f2798b869 100644
--- a/sdk/src/spine/index.ts
+++ b/sdk/src/spine/index.ts
@@ -12,4 +12,4 @@ export { wrapSpineModule } from './SpineModuleLoader';
// Shared spine scene loader — the editor loads spine entities through the same
// single implementation the builder runtime uses (see ./loadSpineScene).
export { loadSpineSceneEntities, loadSpineAssets, applySpineEntities, spineEntityProps } from './loadSpineScene';
-export type { RuntimeAssetSource } from '../runtimeAssets';
+export type { RuntimeAssetSource } from '../runtime/runtimeAssets';
diff --git a/sdk/src/spine/loadSpineScene.ts b/sdk/src/spine/loadSpineScene.ts
index bcffb21be..4fe820106 100644
--- a/sdk/src/spine/loadSpineScene.ts
+++ b/sdk/src/spine/loadSpineScene.ts
@@ -21,11 +21,11 @@ import type { Entity } from '../types';
import { getComponentSkeletalFieldDescriptor, type SceneData } from '../scene';
import { discoverSceneAssets } from '../asset/discoverAssets';
import { getAssetTypeEntry } from '../assetTypes';
-import { requireResourceManager } from '../resourceManager';
+import { requireResourceManager } from '../wasm/resourceManager';
import { log } from '../logger';
import { SpineManager, type SpineVersion } from './SpineManager';
import { parseSpineAtlasPages } from './atlasPages';
-import { createTextureFromPixels, type RuntimeAssetSource } from '../runtimeAssets';
+import { createTextureFromPixels, type RuntimeAssetSource } from '../runtime/runtimeAssets';
import { isKtx2Path, type BasisTranscoder } from '../asset/compressed';
/**
diff --git a/sdk/src/stats.ts b/sdk/src/stats.ts
index 577b7138d..41350c5dc 100644
--- a/sdk/src/stats.ts
+++ b/sdk/src/stats.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { Renderer } from './renderer';
-import { defineResource, Res, Time } from './resource';
-import { defineSystem, GetWorld, Schedule } from './system';
+import { Renderer } from './render/renderer';
+import { defineResource, Res, Time } from './ecs/resource';
+import { defineSystem, GetWorld, Schedule } from './ecs/system';
import type { App, Plugin } from './app';
import { StatsOverlay, type StatsPosition } from './stats-overlay';
diff --git a/sdk/src/tilemap/components.ts b/sdk/src/tilemap/components.ts
index 29c82c7ba..14c90848e 100644
--- a/sdk/src/tilemap/components.ts
+++ b/sdk/src/tilemap/components.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { defineComponent } from '../component';
+import { defineComponent } from '../ecs/component';
-export { TilemapLayer, type TilemapLayerData } from '../component';
+export { TilemapLayer, type TilemapLayerData } from '../ecs/component';
export interface TilemapData {
source: string;
diff --git a/sdk/src/tilemap/index.ts b/sdk/src/tilemap/index.ts
index 8e11ab994..dd14c8e26 100644
--- a/sdk/src/tilemap/index.ts
+++ b/sdk/src/tilemap/index.ts
@@ -55,7 +55,7 @@ export {
registerResolvedTileset, getResolvedTileset, clearResolvedTilesetCache,
type LoadedTilemapSource, type LoadedTilemapLayer, type LoadedTilemapTileset,
} from './tilesetCache';
-export { getTextureDimensions, type TextureDimensions } from '../resourceManager';
+export { getTextureDimensions, type TextureDimensions } from '../wasm/resourceManager';
export {
tileCollisionAt, isTileSolid, tileCollisionAtWorld,
diff --git a/sdk/src/tilemap/tiledLoader.ts b/sdk/src/tilemap/tiledLoader.ts
index ade82fb0b..41310f7f7 100644
--- a/sdk/src/tilemap/tiledLoader.ts
+++ b/sdk/src/tilemap/tiledLoader.ts
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { TilemapAPI } from './tilemapAPI';
-import type { World } from '../world';
+import type { World } from '../ecs/world';
import type { Entity } from '../types';
import { TilemapLayer } from './components';
-import { Transform, Marker, RuntimeOnly } from '../component';
+import { Transform, Marker, RuntimeOnly } from '../ecs/component';
// Matches TilemapSystem::CHUNK_SIZE on the C++ side.
const TILEMAP_CHUNK_SIZE = 16;
diff --git a/sdk/src/tilemap/tilemapAPI.ts b/sdk/src/tilemap/tilemapAPI.ts
index dc82cd2ed..999209147 100644
--- a/sdk/src/tilemap/tilemapAPI.ts
+++ b/sdk/src/tilemap/tilemapAPI.ts
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { withMalloc } from '../wasmScratch';
-import { WasmBridge } from '../WasmBridge';
-import type { EngineApi } from '../ecs/engineApi';
-import { defineResource } from '../resource';
+import { withMalloc } from '../wasm/wasmScratch';
+import { WasmBridge } from '../wasm/WasmBridge';
+import type { EngineApi } from '../ecs/bridge/engineApi';
+import { defineResource } from '../ecs/resource';
/**
* The tilemap entry points as a core that HAS tilemaps answers them — the shape
diff --git a/sdk/src/tilemap/tilemapPlugin.ts b/sdk/src/tilemap/tilemapPlugin.ts
index d8f9bcc26..a96c36cb7 100644
--- a/sdk/src/tilemap/tilemapPlugin.ts
+++ b/sdk/src/tilemap/tilemapPlugin.ts
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from '../app';
-import { engineApi } from '../ecs/engineApi';
-import { Transform, TilemapLayer, Sprite, Canvas, RuntimeOnly, Marker, type TilemapLayerData } from '../component';
-import { Schedule } from '../system';
-import type { SystemDef } from '../system';
+import { engineApi } from '../ecs/bridge/engineApi';
+import { Transform, TilemapLayer, Sprite, Canvas, RuntimeOnly, Marker, type TilemapLayerData } from '../ecs/component';
+import { Schedule } from '../ecs/system';
+import type { SystemDef } from '../ecs/system';
import { initTilemapAPI, shutdownTilemapAPI, TilemapAPI } from './tilemapAPI';
import { TilemapLiveSync } from './tilemapLiveSync';
import { Tilemap } from './components';
@@ -21,7 +21,7 @@ import {
import { decodeTilemapChunks } from './chunkCodec';
import { Assets } from '../asset/AssetPlugin';
import { resolveAssetKey } from '../asset/resolveAssetKey';
-import { Time } from '../resource';
+import { Time } from '../ecs/resource';
import { playModeOnly } from '../env';
import { log } from '../logger';
import type { Entity } from '../types';
diff --git a/sdk/src/timeline/TimelineControl.ts b/sdk/src/timeline/TimelineControl.ts
index ed0fd1b6d..08c55c895 100644
--- a/sdk/src/timeline/TimelineControl.ts
+++ b/sdk/src/timeline/TimelineControl.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { Entity } from '../types';
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
import { createTimelineState, type TimelineState } from './TimelineDrive';
import { WrapMode } from './TimelineTypes';
diff --git a/sdk/src/timeline/TimelineEvaluator.ts b/sdk/src/timeline/TimelineEvaluator.ts
index c0138b72f..2d3bfea60 100644
--- a/sdk/src/timeline/TimelineEvaluator.ts
+++ b/sdk/src/timeline/TimelineEvaluator.ts
@@ -22,9 +22,9 @@
import { TrackType, InterpType, WrapMode, type TimelineAsset, type PropertyChannel } from './TimelineTypes';
import { setNestedProperty, resolveChildEntity } from './TimelineRuntime';
-import { getComponent, type AnyComponentDef } from '../component';
+import { getComponent, type AnyComponentDef } from '../ecs/component';
import type { Entity } from '../types';
-import type { World } from '../world';
+import type { World } from '../ecs/world';
// ---------------------------------------------------------------------------
// Core math — 1:1 port of TimelineSystem.cpp (keep in lock-step)
diff --git a/sdk/src/timeline/TimelinePlugin.ts b/sdk/src/timeline/TimelinePlugin.ts
index 9e08c034e..b1111524e 100644
--- a/sdk/src/timeline/TimelinePlugin.ts
+++ b/sdk/src/timeline/TimelinePlugin.ts
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from '../app';
-import { defineSystem, Schedule } from '../system';
-import { Res } from '../resource';
-import { Time, type TimeData } from '../resource';
-import { defineComponent, getComponent } from '../component';
+import { defineSystem, Schedule } from '../ecs/system';
+import { Res } from '../ecs/resource';
+import { Time, type TimeData } from '../ecs/resource';
+import { defineComponent, getComponent } from '../ecs/component';
import { playModeOnly } from '../env';
import { Assets } from '../asset/AssetPlugin';
import { resolveAssetKey } from '../asset/resolveAssetKey';
diff --git a/sdk/src/timeline/TimelineRuntime.ts b/sdk/src/timeline/TimelineRuntime.ts
index b6871d2cb..f5cea03ad 100644
--- a/sdk/src/timeline/TimelineRuntime.ts
+++ b/sdk/src/timeline/TimelineRuntime.ts
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { getComponent, SpineAnimation } from '../component';
+import { getComponent, SpineAnimation } from '../ecs/component';
import { SpriteAnimator } from '../animation/SpriteAnimator';
import type { AudioAPI } from '../audio/Audio';
import type { Entity } from '../types';
-import type { World } from '../world';
+import type { World } from '../ecs/world';
/**
* Shared timeline runtime helpers. The timeline is a
diff --git a/sdk/src/timer.ts b/sdk/src/timer.ts
index 9ee26dad8..b6f311f92 100644
--- a/sdk/src/timer.ts
+++ b/sdk/src/timer.ts
@@ -5,10 +5,10 @@
* @brief Frame-based timer system integrated with engine loop
*/
-import { defineResource, Res } from './resource';
-import { defineSystem } from './system';
-import { Schedule } from './system';
-import { Time } from './resource';
+import { defineResource, Res } from './ecs/resource';
+import { defineSystem } from './ecs/system';
+import { Schedule } from './ecs/system';
+import { Time } from './ecs/resource';
import { playModeOnly } from './env';
import { log } from './logger';
import type { Plugin } from './app';
diff --git a/sdk/src/trail/TrailAPI.ts b/sdk/src/trail/TrailAPI.ts
index 722d7568b..bef0b3314 100644
--- a/sdk/src/trail/TrailAPI.ts
+++ b/sdk/src/trail/TrailAPI.ts
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { CppRegistry } from '../wasm';
-import type { EngineApi } from '../ecs/engineApi';
+import type { EngineApi } from '../ecs/bridge/engineApi';
import type { Entity } from '../types';
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
/**
* Per-app motion-trail API. Wraps the C++ registry-scoped trail system so two App
diff --git a/sdk/src/trail/TrailPlugin.ts b/sdk/src/trail/TrailPlugin.ts
index 21d20db58..5ff7ffe9e 100644
--- a/sdk/src/trail/TrailPlugin.ts
+++ b/sdk/src/trail/TrailPlugin.ts
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from '../app';
-import { defineSystem, Schedule } from '../system';
-import { Res } from '../resource';
-import { Time, type TimeData } from '../resource';
+import { defineSystem, Schedule } from '../ecs/system';
+import { Res } from '../ecs/resource';
+import { Time, type TimeData } from '../ecs/resource';
import { fxPreviewOrPlayMode } from '../env';
import type { CppRegistry } from '../wasm';
-import { engineApi } from '../ecs/engineApi';
-import { TrailRenderer } from '../component';
+import { engineApi } from '../ecs/bridge/engineApi';
+import { TrailRenderer } from '../ecs/component';
import { Trail, TrailAPI } from './TrailAPI';
export class TrailPlugin implements Plugin {
diff --git a/sdk/src/ui/behavior/dialog.ts b/sdk/src/ui/behavior/dialog.ts
index 140db919e..edad60336 100644
--- a/sdk/src/ui/behavior/dialog.ts
+++ b/sdk/src/ui/behavior/dialog.ts
@@ -11,11 +11,11 @@
* `createDialog` composes this; the panel swallows clicks with its own
* Interactable, so only true scrim clicks dismiss.
*/
-import { defineComponent } from '../../component';
-import { defineSystem, type SystemDef } from '../../system';
-import { Res } from '../../resource';
-import { Input, type InputState } from '../../input';
-import type { World } from '../../world';
+import { defineComponent } from '../../ecs/component';
+import { defineSystem, type SystemDef } from '../../ecs/system';
+import { Res } from '../../ecs/resource';
+import { Input, type InputState } from '../../input/input';
+import type { World } from '../../ecs/world';
import type { Entity } from '../../types';
import { UINode, UIDisplay, type UINodeData } from '../core/ui-node';
import { UIInteraction, type UIInteractionData } from '../input/interactable';
diff --git a/sdk/src/ui/behavior/dropdown.ts b/sdk/src/ui/behavior/dropdown.ts
index 8496c005c..b11a6bffe 100644
--- a/sdk/src/ui/behavior/dropdown.ts
+++ b/sdk/src/ui/behavior/dropdown.ts
@@ -14,11 +14,11 @@
* The popup is a transient runtime subtree, rebuilt on each open with fresh
* theme colors and tagged with ThemeStyle roles for live re-theming.
*/
-import { defineComponent } from '../../component';
-import { defineSystem, type SystemDef } from '../../system';
-import { Res } from '../../resource';
-import { Input, type InputState } from '../../input';
-import type { World } from '../../world';
+import { defineComponent } from '../../ecs/component';
+import { defineSystem, type SystemDef } from '../../ecs/system';
+import { Res } from '../../ecs/resource';
+import { Input, type InputState } from '../../input/input';
+import type { World } from '../../ecs/world';
import type { Entity } from '../../types';
import { px, percent } from '../core/dimension';
import { spawnUIEntity } from '../core/compose';
diff --git a/sdk/src/ui/behavior/plugin.ts b/sdk/src/ui/behavior/plugin.ts
index ba789b1db..edfb5d633 100644
--- a/sdk/src/ui/behavior/plugin.ts
+++ b/sdk/src/ui/behavior/plugin.ts
@@ -1,16 +1,16 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from '../../app';
-import { Res, Time, type TimeData } from '../../resource';
-import { defineSystem, Schedule } from '../../system';
-import { Input, type InputState } from '../../input';
-import { Transform, type TransformData } from '../../component';
+import { Res, Time, type TimeData } from '../../ecs/resource';
+import { defineSystem, Schedule } from '../../ecs/system';
+import { Input, type InputState } from '../../input/input';
+import { Transform, type TransformData } from '../../ecs/component';
import { playModeOnly } from '../../env';
import type { Entity, Vec2 } from '../../types';
import { UIEvents, UIEventQueue } from '../core/events';
import { UICameraInfo, type UICameraData } from '../core/ui-camera-info';
-import { PluginName, SystemLabel } from '../../systemLabels';
+import { PluginName, SystemLabel } from '../../ecs/systemLabels';
import { ListView, ListViewRegistry } from '../collection/list-view';
import { ScrollContainer, ScrollContainerRegistry } from '../collection/scroll-container';
import { KineticScroll } from '../collection/kinetic-scroll';
@@ -21,7 +21,7 @@ import { UISlider, createSliderSystem } from './slider';
import { UIToggle, createToggleSystem } from './toggle';
import { UIDropdown, createDropdownSystem } from './dropdown';
import { createScrollbarSystem } from './scrollbar';
-import { registerComponent } from '../../component';
+import { registerComponent } from '../../ecs/component';
/** Screen-px slop before a press becomes a scroll drag (matches Draggable). */
const SCROLL_DRAG_THRESHOLD_PX = 5;
diff --git a/sdk/src/ui/behavior/scrollbar.ts b/sdk/src/ui/behavior/scrollbar.ts
index 23f4a4121..922c06118 100644
--- a/sdk/src/ui/behavior/scrollbar.ts
+++ b/sdk/src/ui/behavior/scrollbar.ts
@@ -10,9 +10,9 @@
* (Absolute, out of flow) and no input surface (not interactable). Thumbs are
* theme-tagged (`text` role, alpha preserved) so they re-skin live.
*/
-import { defineSystem, type SystemDef } from '../../system';
-import { Res, Time, type TimeData } from '../../resource';
-import type { World } from '../../world';
+import { defineSystem, type SystemDef } from '../../ecs/system';
+import { Res, Time, type TimeData } from '../../ecs/resource';
+import type { World } from '../../ecs/world';
import type { Entity, Vec2 } from '../../types';
import { px } from '../core/dimension';
import { spawnUIEntity } from '../core/compose';
diff --git a/sdk/src/ui/behavior/slider.ts b/sdk/src/ui/behavior/slider.ts
index 7a4ff9795..5dbb473e0 100644
--- a/sdk/src/ui/behavior/slider.ts
+++ b/sdk/src/ui/behavior/slider.ts
@@ -10,12 +10,12 @@
* drag, keyboard, `handle.setValue`, a data binding, the editor inspector —
* just writes `value`, and change events fire uniformly for all of them.
*/
-import { defineComponent } from '../../component';
-import { defineSystem, type SystemDef } from '../../system';
-import { Res } from '../../resource';
-import { Input, type InputState } from '../../input';
-import { Transform, type TransformData } from '../../component';
-import type { World } from '../../world';
+import { defineComponent } from '../../ecs/component';
+import { defineSystem, type SystemDef } from '../../ecs/system';
+import { Res } from '../../ecs/resource';
+import { Input, type InputState } from '../../input/input';
+import { Transform, type TransformData } from '../../ecs/component';
+import type { World } from '../../ecs/world';
import type { Entity } from '../../types';
import { UIVisual, type UIVisualData } from '../core/ui-visual';
import { UINode, type UINodeData } from '../core/ui-node';
diff --git a/sdk/src/ui/behavior/theme-apply.ts b/sdk/src/ui/behavior/theme-apply.ts
index afb540d59..3f9257350 100644
--- a/sdk/src/ui/behavior/theme-apply.ts
+++ b/sdk/src/ui/behavior/theme-apply.ts
@@ -11,7 +11,7 @@
* `$interaction` colour gears (behavior state) plus `UIVisual`/`Text` (core);
* `theme/` is cross-cutting and may not import up into behaviors.
*/
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import type { Color } from '../../types';
import { ThemeStyle, type ThemeStyleData } from '../theme/theme-style';
import { setTheme, themeColors, type ThemeTokens } from '../theme/tokens';
diff --git a/sdk/src/ui/behavior/toggle.ts b/sdk/src/ui/behavior/toggle.ts
index 0f31f6169..3753da59d 100644
--- a/sdk/src/ui/behavior/toggle.ts
+++ b/sdk/src/ui/behavior/toggle.ts
@@ -10,9 +10,9 @@
* the indicator and fires `change` identically, so a prefab-placed toggle
* works without code.
*/
-import { defineComponent } from '../../component';
-import { defineSystem, type SystemDef } from '../../system';
-import type { World } from '../../world';
+import { defineComponent } from '../../ecs/component';
+import { defineSystem, type SystemDef } from '../../ecs/system';
+import type { World } from '../../ecs/world';
import type { Entity } from '../../types';
import { setUIVisible } from '../core/compose';
import { Interactable, type InteractableData } from '../input/interactable';
diff --git a/sdk/src/ui/binding/bind.ts b/sdk/src/ui/binding/bind.ts
index b7b7cb3b1..cb5fde4fb 100644
--- a/sdk/src/ui/binding/bind.ts
+++ b/sdk/src/ui/binding/bind.ts
@@ -9,9 +9,9 @@
* immediately, then tracks the signal; the binding auto-disposes when the entity
* despawns (and returns a manual dispose).
*/
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import type { Entity } from '../../types';
-import type { ComponentDef } from '../../component';
+import type { ComponentDef } from '../../ecs/component';
import type { ReadonlySignal } from './signal';
/**
diff --git a/sdk/src/ui/binding/two-way.ts b/sdk/src/ui/binding/two-way.ts
index c90ac7288..091b9ce61 100644
--- a/sdk/src/ui/binding/two-way.ts
+++ b/sdk/src/ui/binding/two-way.ts
@@ -15,9 +15,9 @@
* value in its payload: `UISlider.value` (`{ value }`), `UIToggle.isOn`
* (`{ isOn }`), `UIDropdown.selectedIndex` (`{ index }`).
*/
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import type { Entity } from '../../types';
-import type { ComponentDef } from '../../component';
+import type { ComponentDef } from '../../ecs/component';
import { UIEventType, type UIEventQueue } from '../core/events';
import type { Signal } from './signal';
import { bind } from './bind';
diff --git a/sdk/src/ui/collection/list-view.ts b/sdk/src/ui/collection/list-view.ts
index 91387a173..db040d122 100644
--- a/sdk/src/ui/collection/list-view.ts
+++ b/sdk/src/ui/collection/list-view.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { Transform, type TransformData } from '../../component';
+import { Transform, type TransformData } from '../../ecs/component';
import type { Entity, Vec2 } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import type { DataSource } from './data-source';
import type { LayoutProvider, Rect } from './layout-provider';
diff --git a/sdk/src/ui/collection/view-pool.ts b/sdk/src/ui/collection/view-pool.ts
index c0987ded9..f3a2ccb50 100644
--- a/sdk/src/ui/collection/view-pool.ts
+++ b/sdk/src/ui/collection/view-pool.ts
@@ -15,7 +15,7 @@
*/
import type { Entity } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
/**
* Factory + binder pair for a single item type. Registered per type
diff --git a/sdk/src/ui/controller/ai-builtins.ts b/sdk/src/ui/controller/ai-builtins.ts
index a39eec493..65e91cf3a 100644
--- a/sdk/src/ui/controller/ai-builtins.ts
+++ b/sdk/src/ui/controller/ai-builtins.ts
@@ -14,7 +14,7 @@
import { aiRegistry } from '../../ai/fsm/AiContext';
import { setControllerPage } from './ui-controller';
import { UINode } from '../core/ui-node';
-import { UIDisplay } from '../../wasm.generated';
+import { UIDisplay } from '../../wasm/wasm.generated';
/**
* Idempotently register the UI AI glue. `ui.setPage` takes an arg `"controller:page"`
diff --git a/sdk/src/ui/controller/bind-page.ts b/sdk/src/ui/controller/bind-page.ts
index 3b753122a..b2ef638c8 100644
--- a/sdk/src/ui/controller/bind-page.ts
+++ b/sdk/src/ui/controller/bind-page.ts
@@ -12,7 +12,7 @@
* `current` rather than a plain component field, so it goes through
* {@link setControllerPage} instead of a raw insert.
*/
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import type { Entity } from '../../types';
import type { ReadonlySignal } from '../binding/signal';
import { setControllerPage } from './ui-controller';
diff --git a/sdk/src/ui/controller/gear-apply.ts b/sdk/src/ui/controller/gear-apply.ts
index c628ef79f..6cca04c56 100644
--- a/sdk/src/ui/controller/gear-apply.ts
+++ b/sdk/src/ui/controller/gear-apply.ts
@@ -17,15 +17,15 @@
* The read/write/lerp helpers are pure and exported so unit tests (and a future
* editor preview path) can exercise the value logic without a World.
*/
-import { defineSystem, type SystemDef } from '../../system';
-import { getComponent } from '../../component';
-import { Res, Time, type TimeData } from '../../resource';
+import { defineSystem, type SystemDef } from '../../ecs/system';
+import { getComponent } from '../../ecs/component';
+import { Res, Time, type TimeData } from '../../ecs/resource';
import { applyEasing } from '../../animation/Easing';
import { EntityStateMap } from '../util/helpers';
import { Interactable, UIInteraction, type InteractableData, type UIInteractionData } from '../input/interactable';
import { Focusable, FocusManager, type FocusManagerState } from '../input/focusable';
import type { Entity } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import {
UIController,
INTERACTION_CONTROLLER,
diff --git a/sdk/src/ui/controller/plugin.ts b/sdk/src/ui/controller/plugin.ts
index 8ecd39a92..4dba48a7d 100644
--- a/sdk/src/ui/controller/plugin.ts
+++ b/sdk/src/ui/controller/plugin.ts
@@ -11,8 +11,8 @@
* controller's authored `current` page — that is the editor's live preview.
*/
import type { App, Plugin } from '../../app';
-import { Schedule } from '../../system';
-import { SystemLabel } from '../../systemLabels';
+import { Schedule } from '../../ecs/system';
+import { SystemLabel } from '../../ecs/systemLabels';
import { createGearApplySystem, createInteractionControllerDriverSystem } from './gear-apply';
import { ensureControllerAiRegistrations } from './ai-builtins';
diff --git a/sdk/src/ui/controller/ui-controller.ts b/sdk/src/ui/controller/ui-controller.ts
index fcdda37dc..2b1586ebd 100644
--- a/sdk/src/ui/controller/ui-controller.ts
+++ b/sdk/src/ui/controller/ui-controller.ts
@@ -16,10 +16,10 @@
* their properties as `current` changes; the resolution walks self → ancestors so
* a controller can live on the UI root while gears live on the leaves.
*/
-import { defineComponent } from '../../component';
+import { defineComponent } from '../../ecs/component';
import { walkParentChain } from '../util/helpers';
import type { Entity } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
/** One named enum-state: a page list plus the currently selected page name. */
export interface ControllerState {
diff --git a/sdk/src/ui/controller/ui-gear.ts b/sdk/src/ui/controller/ui-gear.ts
index 09e723a7f..89c8ff013 100644
--- a/sdk/src/ui/controller/ui-gear.ts
+++ b/sdk/src/ui/controller/ui-gear.ts
@@ -15,7 +15,7 @@
* the field untouched (the gear "doesn't care" on that page), and page names —
* not indices — key it so reordering a controller's pages never misaligns values.
*/
-import { defineComponent } from '../../component';
+import { defineComponent } from '../../ecs/component';
import type { Color, Vec2, Vec3 } from '../../types';
import type { EasingType } from '../../animation/Easing';
diff --git a/sdk/src/ui/core/compose.ts b/sdk/src/ui/core/compose.ts
index ac585a750..b55455dba 100644
--- a/sdk/src/ui/core/compose.ts
+++ b/sdk/src/ui/core/compose.ts
@@ -12,9 +12,9 @@
import {
Transform,
type TransformData,
-} from '../../component';
+} from '../../ecs/component';
import type { Entity, Vec2 } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import { UINode, UIPositionType, UIDisplay, UIPointerEvents, type UINodeData } from './ui-node';
import { px, auto, type Dimension } from './dimension';
diff --git a/sdk/src/ui/core/events.ts b/sdk/src/ui/core/events.ts
index cecdb9888..91e7d74d4 100644
--- a/sdk/src/ui/core/events.ts
+++ b/sdk/src/ui/core/events.ts
@@ -12,12 +12,12 @@
*/
// The queue class and the shared resource, under their UI-facing names — the
// same objects, so `Res(UIEvents)` and `Res(EntityEvents)` resolve identically.
-export { EntityEventQueue as UIEventQueue, EntityEvents as UIEvents } from '../../entityEvents';
+export { EntityEventQueue as UIEventQueue, EntityEvents as UIEvents } from '../../ecs/entityEvents';
export type {
EntityEvent as UIEvent,
EntityEventHandler as UIEventHandler,
Unsubscribe,
-} from '../../entityEvents';
+} from '../../ecs/entityEvents';
/**
* Common UI event types. Event type strings are open — users may emit any
diff --git a/sdk/src/ui/core/text.ts b/sdk/src/ui/core/text.ts
index f031718ae..d8cbd51c0 100644
--- a/sdk/src/ui/core/text.ts
+++ b/sdk/src/ui/core/text.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { defineComponent, enumOptions } from '../../component';
+import { defineComponent, enumOptions } from '../../ecs/component';
import type { Color } from '../../types';
export const TextAlign = {
diff --git a/sdk/src/ui/core/ui-camera-info.ts b/sdk/src/ui/core/ui-camera-info.ts
index aa95f3b1c..8342eaf2a 100644
--- a/sdk/src/ui/core/ui-camera-info.ts
+++ b/sdk/src/ui/core/ui-camera-info.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { defineResource } from '../../resource';
+import { defineResource } from '../../ecs/resource';
export interface UICameraData {
viewProjection: Float32Array;
diff --git a/sdk/src/ui/core/ui-mask.ts b/sdk/src/ui/core/ui-mask.ts
index 662e154c3..7e7a757a1 100644
--- a/sdk/src/ui/core/ui-mask.ts
+++ b/sdk/src/ui/core/ui-mask.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { defineBuiltin } from '../../component';
+import { defineBuiltin } from '../../ecs/component';
export const MaskMode = {
Scissor: 0,
diff --git a/sdk/src/ui/core/ui-node.ts b/sdk/src/ui/core/ui-node.ts
index 0ac1052f1..3c7db9f92 100644
--- a/sdk/src/ui/core/ui-node.ts
+++ b/sdk/src/ui/core/ui-node.ts
@@ -11,14 +11,14 @@
* builtin; `computed_size_` is C++-internal (not serialized). Construct lengths
* with `px()/percent()/auto()`.
*/
-import { defineBuiltin } from '../../component';
+import { defineBuiltin } from '../../ecs/component';
import { auto, px, type Dimension } from './dimension';
// Positioning scheme (Relative = in flex flow; Absolute = out of flow, placed by
// `inset` against the parent box — covers the old RectTransform anchor/stretch
// cases) and per-item cross-axis alignment override. Both single-sourced from
// the C++ ES_ENUMs via the generated module.
-export { UIPositionType, UIDisplay, UIPointerEvents, AlignSelf } from '../../wasm.generated';
+export { UIPositionType, UIDisplay, UIPointerEvents, AlignSelf } from '../../wasm/wasm.generated';
export interface UINodeData {
/** Relative (flex flow) or Absolute (placed by inset). */
diff --git a/sdk/src/ui/core/ui-visual.ts b/sdk/src/ui/core/ui-visual.ts
index 14671b49d..0c9c5ec16 100644
--- a/sdk/src/ui/core/ui-visual.ts
+++ b/sdk/src/ui/core/ui-visual.ts
@@ -12,7 +12,7 @@
* gone. Geometry comes from the sibling {@link UINode}. Mirrors the C++
* `UIVisual` builtin.
*/
-import { defineBuiltin } from '../../component';
+import { defineBuiltin } from '../../ecs/component';
import type { Color, Vec2, Vec4 } from '../../types';
// Draw mode (None = invisible but render-order/hit-participating; SolidColor;
@@ -27,7 +27,7 @@ import {
UIVisualFit,
UIFillMethod as FillMethod,
UIFillOrigin as FillOrigin,
-} from '../../wasm.generated';
+} from '../../wasm/wasm.generated';
export { UIVisualType, UIVisualFit, FillMethod, FillOrigin };
export interface UIVisualData {
diff --git a/sdk/src/ui/input/drag.ts b/sdk/src/ui/input/drag.ts
index c7dd05a1f..15f6a57cc 100644
--- a/sdk/src/ui/input/drag.ts
+++ b/sdk/src/ui/input/drag.ts
@@ -1,17 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from '../../app';
-import { registerComponent, Transform, Parent, Sprite } from '../../component';
-import type { TransformData, ParentData, SpriteData } from '../../component';
+import { registerComponent, Transform, Parent, Sprite } from '../../ecs/component';
+import type { TransformData, ParentData, SpriteData } from '../../ecs/component';
import { UINode } from '../core/ui-node';
import type { UINodeData } from '../core/ui-node';
import { px } from '../core/dimension';
-import { defineSystem, Schedule } from '../../system';
-import { Res } from '../../resource';
-import { Input } from '../../input';
-import type { InputState } from '../../input';
+import { defineSystem, Schedule } from '../../ecs/system';
+import { Res } from '../../ecs/resource';
+import { Input } from '../../input/input';
+import type { InputState } from '../../input/input';
import type { Entity } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import { Draggable, DragState } from './draggable';
import type { DraggableData, DragStateData } from './draggable';
import { UIInteraction } from './interactable';
@@ -21,7 +21,7 @@ import { UICameraInfo } from '../core/ui-camera-info';
import type { UICameraData } from '../core/ui-camera-info';
import { playModeOnly } from '../../env';
import { getEntityDepth } from '../util/helpers';
-import { SystemLabel, PluginName } from '../../systemLabels';
+import { SystemLabel, PluginName } from '../../ecs/systemLabels';
import { quaternionToAngle2D } from '../util/math';
function worldToLocalDelta(
diff --git a/sdk/src/ui/input/draggable.ts b/sdk/src/ui/input/draggable.ts
index cd8d6f7fb..f82c1091c 100644
--- a/sdk/src/ui/input/draggable.ts
+++ b/sdk/src/ui/input/draggable.ts
@@ -5,7 +5,7 @@
* @brief Drag config (Draggable) + runtime drag state (DragState) components.
* Driven by the DragPlugin system in this concept module.
*/
-import { defineComponent } from '../../component';
+import { defineComponent } from '../../ecs/component';
export interface DraggableData {
enabled: boolean;
diff --git a/sdk/src/ui/input/focus.ts b/sdk/src/ui/input/focus.ts
index f722dac5e..4a30c3571 100644
--- a/sdk/src/ui/input/focus.ts
+++ b/sdk/src/ui/input/focus.ts
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from '../../app';
-import { registerComponent } from '../../component';
-import { defineSystem, Schedule } from '../../system';
-import { Res } from '../../resource';
-import { Input } from '../../input';
-import type { InputState } from '../../input';
+import { registerComponent } from '../../ecs/component';
+import { defineSystem, Schedule } from '../../ecs/system';
+import { Res } from '../../ecs/resource';
+import { Input } from '../../input/input';
+import type { InputState } from '../../input/input';
import type { Entity } from '../../types';
import { Focusable, FocusManager, FocusManagerState } from './focusable';
import type { FocusableData } from './focusable';
@@ -18,9 +18,9 @@ import { UIDialog, isDialogOpen } from '../behavior/dialog';
import { walkParentChain } from '../util/helpers';
import { playModeOnly } from '../../env';
import { UIEvents, UIEventQueue, UIEventType } from '../core/events';
-import { PluginName } from '../../systemLabels';
+import { PluginName } from '../../ecs/systemLabels';
import type { CppRegistry } from '../../wasm';
-import { engineApi } from '../../ecs/engineApi';
+import { engineApi } from '../../ecs/bridge/engineApi';
export class FocusPlugin implements Plugin {
name = PluginName.Focus;
diff --git a/sdk/src/ui/input/focusable.ts b/sdk/src/ui/input/focusable.ts
index 0f89fca0f..4564001de 100644
--- a/sdk/src/ui/input/focusable.ts
+++ b/sdk/src/ui/input/focusable.ts
@@ -6,8 +6,8 @@
* resource tracking the currently-focused entity. Driven by the
* FocusPlugin system in this concept module.
*/
-import { defineComponent } from '../../component';
-import { defineResource } from '../../resource';
+import { defineComponent } from '../../ecs/component';
+import { defineResource } from '../../ecs/resource';
import type { Entity } from '../../types';
export interface FocusableData {
diff --git a/sdk/src/ui/input/interactable.ts b/sdk/src/ui/input/interactable.ts
index 970b9224c..2935e78a3 100644
--- a/sdk/src/ui/input/interactable.ts
+++ b/sdk/src/ui/input/interactable.ts
@@ -6,9 +6,9 @@
* UIInteraction (per-frame pointer state written by the hit-test
* system). Foundation that controllers + drag/focus build on.
*/
-import { defineBuiltin } from '../../component';
+import { defineBuiltin } from '../../ecs/component';
import type { Entity } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import { Focusable } from './focusable';
export interface InteractableData {
diff --git a/sdk/src/ui/input/interaction.ts b/sdk/src/ui/input/interaction.ts
index f15f5a821..76a37ea1c 100644
--- a/sdk/src/ui/input/interaction.ts
+++ b/sdk/src/ui/input/interaction.ts
@@ -1,19 +1,19 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from '../../app';
-import { registerComponent, Transform } from '../../component';
-import { defineSystem, Schedule } from '../../system';
-import { Res } from '../../resource';
-import { Input } from '../../input';
-import type { InputState } from '../../input';
+import { registerComponent, Transform } from '../../ecs/component';
+import { defineSystem, Schedule } from '../../ecs/system';
+import { Res } from '../../ecs/resource';
+import { Input } from '../../input/input';
+import type { InputState } from '../../input/input';
import type { Entity } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import { playModeOnly } from '../../env';
import { Interactable } from './interactable';
import { UIInteraction } from './interactable';
import type { UIInteractionData } from './interactable';
import { UIEventQueue, UIEventType } from '../core/events';
-import { ensureEntityEvents } from '../../entityEvents';
+import { ensureEntityEvents } from '../../ecs/entityEvents';
import { UICameraInfo } from '../core/ui-camera-info';
import type { UICameraData } from '../core/ui-camera-info';
import type { InteractableData } from './interactable';
@@ -21,9 +21,9 @@ import { screenToUiWorld, uiHitTestWorld } from '../util/ui-pick';
import { platformDevicePixelRatio } from '../../platform';
import { ensureComponent, walkParentChain } from '../util/helpers';
import type { CppRegistry } from '../../wasm';
-import { engineApi } from '../../ecs/engineApi';
+import { engineApi } from '../../ecs/bridge/engineApi';
import { UILayoutGeneration } from '../layout/ui-layout-generation';
-import { SystemLabel, PluginName } from '../../systemLabels';
+import { SystemLabel, PluginName } from '../../ecs/systemLabels';
import type { UILayoutGenerationData } from '../layout/ui-layout-generation';
function emitWithBubbling(
diff --git a/sdk/src/ui/layout/flex.ts b/sdk/src/ui/layout/flex.ts
index 061295631..af9e8b427 100644
--- a/sdk/src/ui/layout/flex.ts
+++ b/sdk/src/ui/layout/flex.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { defineBuiltin } from '../../component';
+import { defineBuiltin } from '../../ecs/component';
import type { Vec2 } from '../../types';
-import type { Padding } from '../../wasm.generated';
+import type { Padding } from '../../wasm/wasm.generated';
// -- FlexContainer ------------------------------------------------------------
diff --git a/sdk/src/ui/layout/layout.ts b/sdk/src/ui/layout/layout.ts
index bca57a79e..7c996e21a 100644
--- a/sdk/src/ui/layout/layout.ts
+++ b/sdk/src/ui/layout/layout.ts
@@ -10,10 +10,10 @@
* `flex`/`safe-area` schemas in this module.
*/
import type { App, Plugin } from '../../app';
-import { registerComponent } from '../../component';
-import { defineSystem, Schedule } from '../../system';
-import { SystemLabel } from '../../systemLabels';
-import { Res } from '../../resource';
+import { registerComponent } from '../../ecs/component';
+import { defineSystem, Schedule } from '../../ecs/system';
+import { SystemLabel } from '../../ecs/systemLabels';
+import { Res } from '../../ecs/resource';
import { UINode } from '../core/ui-node';
import { UIVisual } from '../core/ui-visual';
import { FlexContainer } from './flex';
@@ -22,7 +22,7 @@ import type { UICameraData } from '../core/ui-camera-info';
import { UILayoutGeneration } from './ui-layout-generation';
import type { UILayoutGenerationData } from './ui-layout-generation';
import type { CppRegistry } from '../../wasm';
-import { engineApi } from '../../ecs/engineApi';
+import { engineApi } from '../../ecs/bridge/engineApi';
import { initUIHelpers } from '../util/helpers';
export class UILayoutPlugin implements Plugin {
diff --git a/sdk/src/ui/layout/safe-area.ts b/sdk/src/ui/layout/safe-area.ts
index abd832b08..37fcbab66 100644
--- a/sdk/src/ui/layout/safe-area.ts
+++ b/sdk/src/ui/layout/safe-area.ts
@@ -7,15 +7,15 @@
*/
import type { App, Plugin } from '../../app';
import { isWeChat, platformDevicePixelRatio } from '../../platform';
-import { defineComponent, registerComponent } from '../../component';
-import { Res } from '../../resource';
-import { defineSystem, Schedule } from '../../system';
+import { defineComponent, registerComponent } from '../../ecs/component';
+import { Res } from '../../ecs/resource';
+import { defineSystem, Schedule } from '../../ecs/system';
import { UICameraInfo } from '../core/ui-camera-info';
import type { UICameraData } from '../core/ui-camera-info';
import { UINode } from '../core/ui-node';
import type { UINodeData } from '../core/ui-node';
import { px } from '../core/dimension';
-import { SystemLabel, PluginName } from '../../systemLabels';
+import { SystemLabel, PluginName } from '../../ecs/systemLabels';
export interface SafeAreaData {
applyTop: boolean;
diff --git a/sdk/src/ui/layout/ui-layout-generation.ts b/sdk/src/ui/layout/ui-layout-generation.ts
index 730e41f46..6c4df63d9 100644
--- a/sdk/src/ui/layout/ui-layout-generation.ts
+++ b/sdk/src/ui/layout/ui-layout-generation.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { defineResource } from '../../resource';
+import { defineResource } from '../../ecs/resource';
export interface UILayoutGenerationData {
generation: number;
diff --git a/sdk/src/ui/render/mask.ts b/sdk/src/ui/render/mask.ts
index f820e2b26..c8d9f964c 100644
--- a/sdk/src/ui/render/mask.ts
+++ b/sdk/src/ui/render/mask.ts
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from '../../app';
-import { registerComponent } from '../../component';
+import { registerComponent } from '../../ecs/component';
import { UIMask } from '../core/ui-mask';
-import { PluginName } from '../../systemLabels';
+import { PluginName } from '../../ecs/systemLabels';
export class UIMaskPlugin implements Plugin {
name = PluginName.UIMask;
diff --git a/sdk/src/ui/render/render-order.ts b/sdk/src/ui/render/render-order.ts
index 9d8ba3f3d..e9ba30a9e 100644
--- a/sdk/src/ui/render/render-order.ts
+++ b/sdk/src/ui/render/render-order.ts
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from '../../app';
-import { defineSystem, Schedule } from '../../system';
+import { defineSystem, Schedule } from '../../ecs/system';
import type { CppRegistry } from '../../wasm';
-import { engineApi } from '../../ecs/engineApi';
-import { PluginName } from '../../systemLabels';
+import { engineApi } from '../../ecs/bridge/engineApi';
+import { PluginName } from '../../ecs/systemLabels';
export class UIRenderOrderPlugin implements Plugin {
name = PluginName.UIRenderOrder;
diff --git a/sdk/src/ui/text/atlas-page-store.ts b/sdk/src/ui/text/atlas-page-store.ts
index c7b611ec1..f6b7ee2d9 100644
--- a/sdk/src/ui/text/atlas-page-store.ts
+++ b/sdk/src/ui/text/atlas-page-store.ts
@@ -8,8 +8,8 @@
* renderer can pass it straight to submitTextBatch as the atlas texture.
*/
import type { ESEngineModule } from '../../wasm';
-import { createTextureFromPixels, updateTextureSubregion } from '../../runtimeAssets';
-import { requireResourceManager } from '../../resourceManager';
+import { createTextureFromPixels, updateTextureSubregion } from '../../runtime/runtimeAssets';
+import { requireResourceManager } from '../../wasm/resourceManager';
import type { AtlasPageStore } from './glyph-atlas';
export class EngineAtlasPageStore implements AtlasPageStore {
diff --git a/sdk/src/ui/text/inline-image-plugin.ts b/sdk/src/ui/text/inline-image-plugin.ts
index 4f2018782..353690ad9 100644
--- a/sdk/src/ui/text/inline-image-plugin.ts
+++ b/sdk/src/ui/text/inline-image-plugin.ts
@@ -17,7 +17,7 @@
* cached; a child stays hidden until its texture lands.
*/
import type { App, Plugin } from '../../app';
-import { defineSystem, Schedule } from '../../system';
+import { defineSystem, Schedule } from '../../ecs/system';
import { resolveTextFamily } from './font-registry';
import type { Entity } from '../../types';
import type { ESEngineModule } from '../../wasm';
diff --git a/sdk/src/ui/text/plugin.ts b/sdk/src/ui/text/plugin.ts
index 4f785011b..de9bb0b66 100644
--- a/sdk/src/ui/text/plugin.ts
+++ b/sdk/src/ui/text/plugin.ts
@@ -10,8 +10,8 @@
* {@link resolveTextRenderMode}.
*/
import type { App, Plugin } from '../../app';
-import { Transform, type TransformData, registerComponent } from '../../component';
-import { defineSystem, Schedule } from '../../system';
+import { Transform, type TransformData, registerComponent } from '../../ecs/component';
+import { defineSystem, Schedule } from '../../ecs/system';
import type { ESEngineModule, CppRegistry } from '../../wasm';
import type { Entity } from '../../types';
import { SdfTextRenderer } from './text-renderer';
@@ -25,7 +25,7 @@ import { UICameraInfo, type UICameraData } from '../core/ui-camera-info';
import { getUINodeWidth, getUINodeHeight, ensureUIVisual } from '../util/helpers';
import { resolveTextFamily } from './font-registry';
import { platformDevicePixelRatio } from '../../platform';
-import { engineApi } from '../../ecs/engineApi';
+import { engineApi } from '../../ecs/bridge/engineApi';
// Base glyph rasterization size in CSS px; the real source is this × DPR so text
// stays crisp on HiDPI displays. 64 covers common UI sizes at 1:1 or finer.
diff --git a/sdk/src/ui/text/sdf.ts b/sdk/src/ui/text/sdf.ts
index bc898b7af..9edfa81b2 100644
--- a/sdk/src/ui/text/sdf.ts
+++ b/sdk/src/ui/text/sdf.ts
@@ -9,7 +9,7 @@
* supports cheap outline/shadow.
*/
import type { ESEngineModule } from '../../wasm';
-import { withScratch } from '../../wasmScratch';
+import { withScratch } from '../../wasm/wasmScratch';
/**
* Convert a tight `width*height` alpha coverage buffer to a single-channel SDF.
diff --git a/sdk/src/ui/text/submit.ts b/sdk/src/ui/text/submit.ts
index f41e1fe81..8193d8795 100644
--- a/sdk/src/ui/text/submit.ts
+++ b/sdk/src/ui/text/submit.ts
@@ -8,7 +8,7 @@
* batch-shader variant. Mirrors the proven spine mesh-submit path.
*/
import type { ESEngineModule } from '../../wasm';
-import { withScratch } from '../../wasmScratch';
+import { withScratch } from '../../wasm/wasmScratch';
/** Floats per glyph vertex: position(2) + uv(2) + color(4). */
export const TEXT_VERTEX_FLOATS = 8;
diff --git a/sdk/src/ui/text/text-input-plugin.ts b/sdk/src/ui/text/text-input-plugin.ts
index 466fadd4b..02b5fcdf1 100644
--- a/sdk/src/ui/text/text-input-plugin.ts
+++ b/sdk/src/ui/text/text-input-plugin.ts
@@ -2,8 +2,8 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { App, Plugin } from '../../app';
import type { Entity } from '../../types';
-import { defineSystem, Schedule } from '../../system';
-import { registerComponent } from '../../component';
+import { defineSystem, Schedule } from '../../ecs/system';
+import { registerComponent } from '../../ecs/component';
import { TextInput, type TextInputData } from './text-input';
import { UINode, UIPositionType, type UINodeData } from '../core/ui-node';
import { UIVisual, UIVisualType } from '../core/ui-visual';
@@ -13,9 +13,9 @@ import { Text, TextAlign, TextVerticalAlign, type TextData } from '../core/text'
import { Interactable, UIInteraction, type UIInteractionData } from '../input/interactable';
import { Focusable, FocusManager, FocusManagerState } from '../input/focusable';
import { UICameraInfo, type UICameraData } from '../core/ui-camera-info';
-import { Transform, type TransformData } from '../../component';
+import { Transform, type TransformData } from '../../ecs/component';
import { UIEvents, UIEventQueue } from '../core/events';
-import { Res } from '../../resource';
+import { Res } from '../../ecs/resource';
import { playModeOnly } from '../../env';
import { ensureComponent, getUINodeWidth, getUINodeHeight } from '../util/helpers';
import { spawnUIEntity } from '../core/compose';
@@ -30,7 +30,7 @@ import {
import { uiWorldToScreen } from '../util/ui-pick';
import { platformCreateTextEditor, platformDevicePixelRatio } from '../../platform';
import { CURSOR_BLINK_INTERVAL, TEXT_INPUT_LINE_HEIGHT_RATIO } from '../util/constants';
-import { SystemLabel, PluginName } from '../../systemLabels';
+import { SystemLabel, PluginName } from '../../ecs/systemLabels';
import { log } from '../../logger';
/** Masking bullet for password fields. */
diff --git a/sdk/src/ui/text/text-input.ts b/sdk/src/ui/text/text-input.ts
index e537afbae..83e216ca3 100644
--- a/sdk/src/ui/text/text-input.ts
+++ b/sdk/src/ui/text/text-input.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { defineComponent, enumOptions } from '../../component';
+import { defineComponent, enumOptions } from '../../ecs/component';
import type { Color } from '../../types';
import { TextRenderMode } from '../core/text';
diff --git a/sdk/src/ui/theme/theme-style.ts b/sdk/src/ui/theme/theme-style.ts
index 09fc3eeb7..87eaab46e 100644
--- a/sdk/src/ui/theme/theme-style.ts
+++ b/sdk/src/ui/theme/theme-style.ts
@@ -13,8 +13,8 @@
* into prefabs/scenes — an editor-placed widget must re-theme like a
* code-constructed one.
*/
-import { defineComponent } from '../../component';
-import type { World } from '../../world';
+import { defineComponent } from '../../ecs/component';
+import type { World } from '../../ecs/world';
import type { Entity } from '../../types';
import type { ThemeColors } from './tokens';
diff --git a/sdk/src/ui/util/helpers.ts b/sdk/src/ui/util/helpers.ts
index 6427caa3b..c9473887c 100644
--- a/sdk/src/ui/util/helpers.ts
+++ b/sdk/src/ui/util/helpers.ts
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { Parent } from '../../component';
-import type { ParentData, AnyComponentDef } from '../../component';
+import { Parent } from '../../ecs/component';
+import type { ParentData, AnyComponentDef } from '../../ecs/component';
import type { Entity } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import { UIVisual, UIVisualType } from '../core/ui-visual';
import type { CppRegistry } from '../../wasm';
-import type { EngineApi } from '../../ecs/engineApi';
-import { WasmBridge } from '../../WasmBridge';
+import type { EngineApi } from '../../ecs/bridge/engineApi';
+import { WasmBridge } from '../../wasm/WasmBridge';
/** The helpers' view of the engine, guarded: after a wasm abort a call throws
* {@link WasmModuleAborted} instead of reaching a dead module. A native host's
diff --git a/sdk/src/ui/util/ui-pick.ts b/sdk/src/ui/util/ui-pick.ts
index 22ecf633c..d7be215b9 100644
--- a/sdk/src/ui/util/ui-pick.ts
+++ b/sdk/src/ui/util/ui-pick.ts
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { Entity } from '../../types';
import type { CppRegistry } from '../../wasm';
-import type { EngineApi } from '../../ecs/engineApi';
+import type { EngineApi } from '../../ecs/bridge/engineApi';
import type { UICameraData } from '../core/ui-camera-info';
import { screenToWorld, worldToScreen, createInvVPCache } from './math';
diff --git a/sdk/src/ui/widgets/button.ts b/sdk/src/ui/widgets/button.ts
index f169d9ed1..8ab19e83f 100644
--- a/sdk/src/ui/widgets/button.ts
+++ b/sdk/src/ui/widgets/button.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { Color, Entity } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import { Interactable, type InteractableData } from '../input/interactable';
import {
diff --git a/sdk/src/ui/widgets/dialog.ts b/sdk/src/ui/widgets/dialog.ts
index c9ca7aec9..d27df38fd 100644
--- a/sdk/src/ui/widgets/dialog.ts
+++ b/sdk/src/ui/widgets/dialog.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { Entity } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import { spawnUIEntity, type UINodeInit, type UIVisualInit } from '../core/compose';
import { makeWidgetInteractable } from '../input/interactable';
diff --git a/sdk/src/ui/widgets/dropdown.ts b/sdk/src/ui/widgets/dropdown.ts
index e2f15af2a..63b6d70cc 100644
--- a/sdk/src/ui/widgets/dropdown.ts
+++ b/sdk/src/ui/widgets/dropdown.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { Color, Entity } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import { UIController, interactionController } from '../controller/ui-controller';
import { UIGear } from '../controller/ui-gear';
diff --git a/sdk/src/ui/widgets/list-view.ts b/sdk/src/ui/widgets/list-view.ts
index 66bfbd54d..5e4f7f667 100644
--- a/sdk/src/ui/widgets/list-view.ts
+++ b/sdk/src/ui/widgets/list-view.ts
@@ -15,7 +15,7 @@
* hovered raycast target.
*/
import type { Entity, Vec2 } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import { UINode, UIPositionType, type UINodeData } from '../core/ui-node';
import { px, auto } from '../core/dimension';
diff --git a/sdk/src/ui/widgets/progress.ts b/sdk/src/ui/widgets/progress.ts
index c0e5c2761..78d547874 100644
--- a/sdk/src/ui/widgets/progress.ts
+++ b/sdk/src/ui/widgets/progress.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { Color, Entity } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import {
UIVisual,
diff --git a/sdk/src/ui/widgets/scroll-view.ts b/sdk/src/ui/widgets/scroll-view.ts
index afb437efe..d566dca16 100644
--- a/sdk/src/ui/widgets/scroll-view.ts
+++ b/sdk/src/ui/widgets/scroll-view.ts
@@ -10,7 +10,7 @@
* `content`; sizes are explicit because scroll math needs them up front.
*/
import type { Entity, Vec2 } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import { UINode, UIPositionType, type UINodeData } from '../core/ui-node';
import { px } from '../core/dimension';
diff --git a/sdk/src/ui/widgets/slider.ts b/sdk/src/ui/widgets/slider.ts
index 395f6784c..769f69bb2 100644
--- a/sdk/src/ui/widgets/slider.ts
+++ b/sdk/src/ui/widgets/slider.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { Entity } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import { px, percent } from '../core/dimension';
import { UIVisualType } from '../core/ui-visual';
diff --git a/sdk/src/ui/widgets/text-input.ts b/sdk/src/ui/widgets/text-input.ts
index 90f339fcc..34160a6aa 100644
--- a/sdk/src/ui/widgets/text-input.ts
+++ b/sdk/src/ui/widgets/text-input.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { Color, Entity } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import { px } from '../core/dimension';
import { type UIEventQueue } from '../core/events';
diff --git a/sdk/src/ui/widgets/toPrefab.ts b/sdk/src/ui/widgets/toPrefab.ts
index c2575fd8f..ba289e75b 100644
--- a/sdk/src/ui/widgets/toPrefab.ts
+++ b/sdk/src/ui/widgets/toPrefab.ts
@@ -11,7 +11,7 @@
* drop-in, themed control asset generated from the exact same code the runtime
* uses — no hand-authored duplicate to drift.
*/
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import type { Entity } from '../../types';
import { extractPrefab, type ExtractEntity } from '../../prefab/sceneInstance';
import type { PrefabData, ComponentData } from '../../prefab/types';
diff --git a/sdk/src/ui/widgets/toggle.ts b/sdk/src/ui/widgets/toggle.ts
index 75c4a3dd0..055c096fe 100644
--- a/sdk/src/ui/widgets/toggle.ts
+++ b/sdk/src/ui/widgets/toggle.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import type { Color, Entity } from '../../types';
-import type { World } from '../../world';
+import type { World } from '../../ecs/world';
import { UIEventType, type UIEventQueue } from '../core/events';
import type { ButtonStateVisual } from '../controller/interaction-gears';
diff --git a/sdk/src/velocity.ts b/sdk/src/velocity.ts
index bae5547be..64c4cbcb0 100644
--- a/sdk/src/velocity.ts
+++ b/sdk/src/velocity.ts
@@ -5,14 +5,14 @@
* @brief Velocity concept — integrates the builtin Velocity component into Transform.
*/
import type { Plugin } from './app';
-import { defineSystem, Schedule, GetWorld } from './system';
-import { Query, Mut } from './query';
-import { Res, Time, type TimeData } from './resource';
+import { defineSystem, Schedule, GetWorld } from './ecs/system';
+import { Query, Mut } from './ecs/query';
+import { Res, Time, type TimeData } from './ecs/resource';
import { playModeOnly } from './env';
-import { Transform, Velocity, getComponentRegistry } from './component';
-import type { TransformData, VelocityData } from './component';
+import { Transform, Velocity, getComponentRegistry } from './ecs/component';
+import type { TransformData, VelocityData } from './ecs/component';
import type { Entity } from './types';
-import type { World } from './world';
+import type { World } from './ecs/world';
export const velocitySystem = defineSystem(
[Query(Mut(Transform), Velocity), Res(Time), GetWorld()],
diff --git a/sdk/src/video/VideoAPI.ts b/sdk/src/video/VideoAPI.ts
index 0b000c2a7..e5cbd2a31 100644
--- a/sdk/src/video/VideoAPI.ts
+++ b/sdk/src/video/VideoAPI.ts
@@ -4,7 +4,7 @@
// the VideoPlayer resource.
import type { ESEngineModule } from '../wasm';
import type { PlatformVideoBackend, VideoStreamHandle, VideoStreamOptions } from './PlatformVideoBackend';
-import { defineResource } from '../resource';
+import { defineResource } from '../ecs/resource';
import { log } from '../logger';
export type VideoHandle = VideoStreamHandle;
diff --git a/sdk/src/video/VideoComponents.ts b/sdk/src/video/VideoComponents.ts
index 7f6fb953b..3021cd8f7 100644
--- a/sdk/src/video/VideoComponents.ts
+++ b/sdk/src/video/VideoComponents.ts
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
// The declarative Video component. It renders through its entity's Sprite (the
// system writes the live frame texture into it), so a Video needs a Sprite.
-import { defineComponent } from '../component';
+import { defineComponent } from '../ecs/component';
export interface VideoData {
source: string;
diff --git a/sdk/src/video/VideoPlugin.ts b/sdk/src/video/VideoPlugin.ts
index e14b84338..8ee03ae89 100644
--- a/sdk/src/video/VideoPlugin.ts
+++ b/sdk/src/video/VideoPlugin.ts
@@ -4,13 +4,13 @@
// and runs one play-mode system that streams each Video onto its renderable.
import type { App, Plugin } from '../app';
import type { Entity } from '../types';
-import type { World } from '../world';
-import { defineSystem, Schedule } from '../system';
-import { Res, Time, type TimeData } from '../resource';
+import type { World } from '../ecs/world';
+import { defineSystem, Schedule } from '../ecs/system';
+import { Res, Time, type TimeData } from '../ecs/resource';
import { VideoPlayer, VideoAPI } from './VideoAPI';
import { Video, type VideoData } from './VideoComponents';
-import { Sprite, Mesh2D, type SpriteData, type Mesh2DData } from '../component';
-import type { UIVisualData } from '../component.generated';
+import { Sprite, Mesh2D, type SpriteData, type Mesh2DData } from '../ecs/component';
+import type { UIVisualData } from '../ecs/component.generated';
import { UIVisual } from '../ui/core/ui-visual';
import type { VideoStreamHandle } from './PlatformVideoBackend';
import { NullVideoBackend } from './NullVideoBackend';
diff --git a/sdk/src/video/WasmVideoBackend.ts b/sdk/src/video/WasmVideoBackend.ts
index 3d024f364..ea2fb2d42 100644
--- a/sdk/src/video/WasmVideoBackend.ts
+++ b/sdk/src/video/WasmVideoBackend.ts
@@ -23,8 +23,8 @@ import type { PlatformVideoBackend, VideoBackendContext, VideoStreamHandle, Vide
import type { SideModule } from '../sideModules/host';
import type { AudioAPI } from '../audio/Audio';
import type { AudioHandle } from '../audio/PlatformAudioBackend';
-import { createTextureFromPixels, updateTextureSubregion } from '../runtimeAssets';
-import { requireResourceManager } from '../resourceManager';
+import { createTextureFromPixels, updateTextureSubregion } from '../runtime/runtimeAssets';
+import { requireResourceManager } from '../wasm/resourceManager';
import { getPlatform } from '../platform/base';
import { log } from '../logger';
diff --git a/sdk/src/video/WebVideoBackend.ts b/sdk/src/video/WebVideoBackend.ts
index 4cb73dc4b..59f059af0 100644
--- a/sdk/src/video/WebVideoBackend.ts
+++ b/sdk/src/video/WebVideoBackend.ts
@@ -5,8 +5,8 @@
// (zero-copy), else a canvas readback feeds updateTextureSubregion (WebGPU).
import type { ESEngineModule } from '../wasm';
import type { PlatformVideoBackend, VideoStreamHandle, VideoStreamOptions } from './PlatformVideoBackend';
-import { createTextureFromPixels, updateTextureSubregion } from '../runtimeAssets';
-import { requireResourceManager } from '../resourceManager';
+import { createTextureFromPixels, updateTextureSubregion } from '../runtime/runtimeAssets';
+import { requireResourceManager } from '../wasm/resourceManager';
import { findWebGL2Context } from '../asset/loaders/TextureLoader';
import { linearColorSpace } from '../env';
import { log } from '../logger';
diff --git a/sdk/src/wasm.ts b/sdk/src/wasm.ts
index 6133ff323..3bb4b8f05 100644
--- a/sdk/src/wasm.ts
+++ b/sdk/src/wasm.ts
@@ -6,7 +6,7 @@
*/
import { Entity } from './types';
-import type { Registry as GeneratedRegistry } from './wasm.generated';
+import type { Registry as GeneratedRegistry } from './wasm/wasm.generated';
// =============================================================================
// C++ Registry Interface
diff --git a/sdk/src/CoreApiBridge.ts b/sdk/src/wasm/CoreApiBridge.ts
similarity index 95%
rename from sdk/src/CoreApiBridge.ts
rename to sdk/src/wasm/CoreApiBridge.ts
index afdfedc99..d194ba6f5 100644
--- a/sdk/src/CoreApiBridge.ts
+++ b/sdk/src/wasm/CoreApiBridge.ts
@@ -14,7 +14,7 @@
* the dead flag is shared by module identity.
*/
-import type { ESEngineModule } from './wasm';
+import type { ESEngineModule } from '../wasm';
import { WasmBridge } from './WasmBridge';
export class CoreApiBridge extends WasmBridge<ESEngineModule> {
diff --git a/sdk/src/WasmBridge.ts b/sdk/src/wasm/WasmBridge.ts
similarity index 100%
rename from sdk/src/WasmBridge.ts
rename to sdk/src/wasm/WasmBridge.ts
diff --git a/sdk/src/moduleHealth.ts b/sdk/src/wasm/moduleHealth.ts
similarity index 100%
rename from sdk/src/moduleHealth.ts
rename to sdk/src/wasm/moduleHealth.ts
diff --git a/sdk/src/ptrLayouts.generated.ts b/sdk/src/wasm/ptrLayouts.generated.ts
similarity index 100%
rename from sdk/src/ptrLayouts.generated.ts
rename to sdk/src/wasm/ptrLayouts.generated.ts
diff --git a/sdk/src/resourceManager.ts b/sdk/src/wasm/resourceManager.ts
similarity index 98%
rename from sdk/src/resourceManager.ts
rename to sdk/src/wasm/resourceManager.ts
index 537177867..9286a8218 100644
--- a/sdk/src/resourceManager.ts
+++ b/sdk/src/wasm/resourceManager.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import type { CppResourceManager, ESEngineModule } from './wasm';
+import type { CppResourceManager, ESEngineModule } from '../wasm';
import { WasmBridge } from './WasmBridge';
export interface TextureDimensions {
diff --git a/sdk/src/wasm.generated.ts b/sdk/src/wasm/wasm.generated.ts
similarity index 99%
rename from sdk/src/wasm.generated.ts
rename to sdk/src/wasm/wasm.generated.ts
index 7ca9a5dc2..4f7b6b06c 100644
--- a/sdk/src/wasm.generated.ts
+++ b/sdk/src/wasm/wasm.generated.ts
@@ -4,7 +4,7 @@
* @details Generated by EHT - DO NOT EDIT
*/
-import type { Entity, Vec2, Vec3, Vec4, Quat } from './types';
+import type { Entity, Vec2, Vec3, Vec4, Quat } from '../types';
// Additional Math Types
export interface UVec2 { x: number; y: number; }
diff --git a/sdk/src/wasmError.ts b/sdk/src/wasm/wasmError.ts
similarity index 91%
rename from sdk/src/wasmError.ts
rename to sdk/src/wasm/wasmError.ts
index 403fdbef4..aa7c169d0 100644
--- a/sdk/src/wasmError.ts
+++ b/sdk/src/wasm/wasmError.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { log } from './logger';
-import { getDefaultContext, type WasmErrorHandler } from './context';
+import { log } from '../logger';
+import { getDefaultContext, type WasmErrorHandler } from '../ecs/context';
import { WasmModuleAborted } from './moduleHealth';
const THROTTLE_MS = 1000;
diff --git a/sdk/src/wasmScratch.ts b/sdk/src/wasm/wasmScratch.ts
similarity index 100%
rename from sdk/src/wasmScratch.ts
rename to sdk/src/wasm/wasmScratch.ts
diff --git a/sdk/tests/ai-builtin-verbs.test.ts b/sdk/tests/ai-builtin-verbs.test.ts
index 469fd706b..3ea7ae402 100644
--- a/sdk/tests/ai-builtin-verbs.test.ts
+++ b/sdk/tests/ai-builtin-verbs.test.ts
@@ -12,9 +12,9 @@ import { ensureBuiltinAiRegistrations } from '../src/ai/builtins';
import { ensureControllerAiRegistrations } from '../src/ui/controller/ai-builtins';
import { Blackboard } from '../src/ai/fsm/Blackboard';
import { UINode } from '../src/ui/core/ui-node';
-import { UIDisplay } from '../src/wasm.generated';
-import { registerComponent, defineComponent } from '../src/component';
-import type { AnyComponentDef } from '../src/component';
+import { UIDisplay } from '../src/wasm/wasm.generated';
+import { registerComponent, defineComponent } from '../src/ecs/component';
+import type { AnyComponentDef } from '../src/ecs/component';
import type { Entity } from '../src/types';
const Score = defineComponent<{ points: number; label: string }>('TestScore', { points: 0, label: '' });
diff --git a/sdk/tests/ai-enemy-integration.test.ts b/sdk/tests/ai-enemy-integration.test.ts
index f08895dbc..f6114cccd 100644
--- a/sdk/tests/ai-enemy-integration.test.ts
+++ b/sdk/tests/ai-enemy-integration.test.ts
@@ -7,10 +7,10 @@
* the AI1 (nav) + AI2 (fsm) seam that unit tests cover only in isolation.
*/
import { describe, it, expect, beforeEach } from 'vitest';
-import { Transform } from '../src/component';
+import { Transform } from '../src/ecs/component';
import type { Entity } from '../src/types';
-import type { CommandsInstance } from '../src/commands';
-import type { AnyComponentDef, ComponentData } from '../src/component';
+import type { CommandsInstance } from '../src/ecs/commands';
+import type { AnyComponentDef, ComponentData } from '../src/ecs/component';
import { NavGrid } from '../src/ai/nav/NavGrid';
import { Navigation } from '../src/ai/nav/Navigation';
import { NavAgent, setNavDestination } from '../src/ai/nav/NavAgent';
diff --git a/sdk/tests/anim-clip-asset.test.ts b/sdk/tests/anim-clip-asset.test.ts
index 6d4263dd8..7a2299fb6 100644
--- a/sdk/tests/anim-clip-asset.test.ts
+++ b/sdk/tests/anim-clip-asset.test.ts
@@ -23,7 +23,7 @@ import {
getComponentAssetFieldDescriptors,
type AssetFieldType,
} from '../src/scene';
-import { defineComponent } from '../src/component';
+import { defineComponent } from '../src/ecs/component';
function ensureSpriteAnimator() {
defineComponent('SpriteAnimator', {
diff --git a/sdk/tests/app-tick.test.ts b/sdk/tests/app-tick.test.ts
index 5449c3316..38f818d72 100644
--- a/sdk/tests/app-tick.test.ts
+++ b/sdk/tests/app-tick.test.ts
@@ -2,9 +2,9 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect } from 'vitest';
import { App } from '../src/app';
-import { Schedule, defineSystem } from '../src/system';
-import { Time } from '../src/resource';
-import { defineResource, Res } from '../src/resource';
+import { Schedule, defineSystem } from '../src/ecs/system';
+import { Time } from '../src/ecs/resource';
+import { defineResource, Res } from '../src/ecs/resource';
describe('App.tick()', () => {
it('should lazily initialize runner and Time resource', async () => {
diff --git a/sdk/tests/asset-group-loading.test.ts b/sdk/tests/asset-group-loading.test.ts
index 424f16e15..ffb80a2a1 100644
--- a/sdk/tests/asset-group-loading.test.ts
+++ b/sdk/tests/asset-group-loading.test.ts
@@ -15,7 +15,7 @@ const mockModule = {
FS: null,
} as any;
-vi.mock('../src/resourceManager', () => ({
+vi.mock('../src/wasm/resourceManager', () => ({
requireResourceManager: () => ({
createTexture: vi.fn(() => 42),
registerExternalTexture: vi.fn(() => 42),
diff --git a/sdk/tests/asset-handle-path.test.ts b/sdk/tests/asset-handle-path.test.ts
index ba5665019..5f6fb059c 100644
--- a/sdk/tests/asset-handle-path.test.ts
+++ b/sdk/tests/asset-handle-path.test.ts
@@ -20,7 +20,7 @@ const mockModule = {
FS: null,
} as never;
-vi.mock('../src/resourceManager', () => ({
+vi.mock('../src/wasm/resourceManager', () => ({
requireResourceManager: () => ({
createTexture: vi.fn(() => 42),
registerExternalTexture: vi.fn(() => 42),
diff --git a/sdk/tests/asset-missing.test.ts b/sdk/tests/asset-missing.test.ts
index fda1a0fb9..1ced6ed6b 100644
--- a/sdk/tests/asset-missing.test.ts
+++ b/sdk/tests/asset-missing.test.ts
@@ -10,7 +10,7 @@
* a stub Assets that only exercises the unresolved-ref branch.
*/
import { describe, it, expect, beforeEach } from 'vitest';
-import { defineComponent, clearUserComponents } from '../src/component';
+import { defineComponent, clearUserComponents } from '../src/ecs/component';
import { discoverSceneAssets } from '../src/asset/discoverAssets';
import { AssetRegistry, makeUuidRef } from '../src/asset/AssetRegistry';
import type { SceneData } from '../src/scene';
diff --git a/sdk/tests/asset-refcount-release.test.ts b/sdk/tests/asset-refcount-release.test.ts
index 62efcdbca..784b415b7 100644
--- a/sdk/tests/asset-refcount-release.test.ts
+++ b/sdk/tests/asset-refcount-release.test.ts
@@ -15,7 +15,7 @@ import type { Backend } from '../src/asset/Backend';
import type { AddressableManifest } from '../src/asset/AddressableManifest';
import type { PlatformAudioBackend, AudioBufferHandle, AudioHandle } from '../src/audio/PlatformAudioBackend';
-vi.mock('../src/resourceManager', () => ({
+vi.mock('../src/wasm/resourceManager', () => ({
requireResourceManager: () => ({
createTexture: vi.fn(() => 42),
registerExternalTexture: vi.fn(() => 42),
diff --git a/sdk/tests/asset-refcounter-integration.test.ts b/sdk/tests/asset-refcounter-integration.test.ts
index 54175085b..60733a9a3 100644
--- a/sdk/tests/asset-refcounter-integration.test.ts
+++ b/sdk/tests/asset-refcounter-integration.test.ts
@@ -10,14 +10,14 @@
* pair that got a non-zero handle.
*/
import { describe, it, expect, vi, beforeEach } from 'vitest';
-import { defineComponent, clearUserComponents } from '../src/component';
+import { defineComponent, clearUserComponents } from '../src/ecs/component';
import { Assets } from '../src/asset/Assets';
import { AssetRefCounter } from '../src/asset/AssetRefCounter';
import type { Backend } from '../src/asset/Backend';
import type { SceneData } from '../src/scene';
import type { SceneAssetResult } from '../src/asset/Assets';
-vi.mock('../src/resourceManager', () => ({
+vi.mock('../src/wasm/resourceManager', () => ({
requireResourceManager: () => ({ releaseTexture: vi.fn() }),
evictTextureDimensions: vi.fn(),
}));
diff --git a/sdk/tests/assets-preload.test.ts b/sdk/tests/assets-preload.test.ts
index a64641e4b..5481d61c0 100644
--- a/sdk/tests/assets-preload.test.ts
+++ b/sdk/tests/assets-preload.test.ts
@@ -12,7 +12,7 @@ import { Catalog, type CatalogData } from '../src/asset/Catalog';
import type { Backend } from '../src/asset/Backend';
import type { AssetLoader } from '../src/asset/AssetLoader';
-vi.mock('../src/resourceManager', () => ({
+vi.mock('../src/wasm/resourceManager', () => ({
requireResourceManager: () => ({
createTexture: vi.fn(() => 42),
registerExternalTexture: vi.fn(() => 42),
diff --git a/sdk/tests/assets.test.ts b/sdk/tests/assets.test.ts
index 1aba02f1a..2de3cd2e1 100644
--- a/sdk/tests/assets.test.ts
+++ b/sdk/tests/assets.test.ts
@@ -14,7 +14,7 @@ const mockModule = {
FS: null,
} as any;
-vi.mock('../src/resourceManager', () => ({
+vi.mock('../src/wasm/resourceManager', () => ({
requireResourceManager: () => ({
createTexture: vi.fn(() => 42),
registerExternalTexture: vi.fn(() => 42),
diff --git a/sdk/tests/async-system.test.ts b/sdk/tests/async-system.test.ts
index c5f8b1067..e60187a8a 100644
--- a/sdk/tests/async-system.test.ts
+++ b/sdk/tests/async-system.test.ts
@@ -2,10 +2,10 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { App } from '../src/app';
-import { defineSystem, Schedule, SystemRunner } from '../src/system';
-import { defineResource, Res, ResMut, ResourceStorage } from '../src/resource';
-import { Commands, CommandsInstance } from '../src/commands';
-import type { World } from '../src/world';
+import { defineSystem, Schedule, SystemRunner } from '../src/ecs/system';
+import { defineResource, Res, ResMut, ResourceStorage } from '../src/ecs/resource';
+import { Commands, CommandsInstance } from '../src/ecs/commands';
+import type { World } from '../src/ecs/world';
import type { Entity } from '../src/types';
// =============================================================================
diff --git a/sdk/tests/behavior.test.ts b/sdk/tests/behavior.test.ts
index 1a7148481..319d62bf1 100644
--- a/sdk/tests/behavior.test.ts
+++ b/sdk/tests/behavior.test.ts
@@ -3,9 +3,9 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { App, flushPendingSystems } from '../src/app';
import { defineBehavior } from '../src/behavior';
-import { AppContext, setDefaultContext } from '../src/context';
-import { getUserComponents } from '../src/component';
-import { Schedule } from '../src/system';
+import { AppContext, setDefaultContext } from '../src/ecs/context';
+import { getUserComponents } from '../src/ecs/component';
+import { Schedule } from '../src/ecs/system';
// Each test gets a fresh context so behaviors/components/pending-systems don't leak.
beforeEach(() => setDefaultContext(new AppContext()));
diff --git a/sdk/tests/bt-agent.test.ts b/sdk/tests/bt-agent.test.ts
index 22d2604d7..5486c8ca0 100644
--- a/sdk/tests/bt-agent.test.ts
+++ b/sdk/tests/bt-agent.test.ts
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
import type { Entity } from '../src/types';
-import type { CommandsInstance } from '../src/commands';
+import type { CommandsInstance } from '../src/ecs/commands';
import { BehaviorTreeAgent, registerBt, clearBtStore } from '../src/ai/bt/BehaviorTreeAgent';
import { aiRegistry, registerAction, registerCondition } from '../src/ai/fsm/AiContext';
import { stepBehaviorTrees, agentBtBlackboard, BehaviorTrees, type AiWorldView } from '../src/ai/bt/BtPlugin';
diff --git a/sdk/tests/builtin-bridge.test.ts b/sdk/tests/builtin-bridge.test.ts
index b4415c994..aadc73fec 100644
--- a/sdk/tests/builtin-bridge.test.ts
+++ b/sdk/tests/builtin-bridge.test.ts
@@ -7,8 +7,8 @@
* generated component metadata in one diagnostic.
*/
import { describe, expect, it } from 'vitest';
-import { BuiltinBridge } from '../src/ecs/BuiltinBridge';
-import { COMPONENT_META, ABI_LAYOUT_HASH } from '../src/component.generated';
+import { BuiltinBridge } from '../src/ecs/bridge/BuiltinBridge';
+import { COMPONENT_META, ABI_LAYOUT_HASH } from '../src/ecs/component.generated';
import type { CppRegistry, ESEngineModule } from '../src/wasm';
function stubMethod() { return undefined; }
diff --git a/sdk/tests/cache-as-bitmap.test.ts b/sdk/tests/cache-as-bitmap.test.ts
index 977cebd32..f68ae950a 100644
--- a/sdk/tests/cache-as-bitmap.test.ts
+++ b/sdk/tests/cache-as-bitmap.test.ts
@@ -8,8 +8,8 @@ import {
removeCacheForEntity,
clearAllCaches,
getCacheStoreSize,
-} from '../src/cacheAsBitmap';
-import type { BitmapCache } from '../src/cacheBitmap';
+} from '../src/render/cacheAsBitmap';
+import type { BitmapCache } from '../src/render/cacheBitmap';
function mockCache(id: number): BitmapCache {
return { textureId: id, width: 256, height: 256, valid: true, _rt: null };
diff --git a/sdk/tests/cache-bitmap.test.ts b/sdk/tests/cache-bitmap.test.ts
index bb7d7845b..5e1d6e457 100644
--- a/sdk/tests/cache-bitmap.test.ts
+++ b/sdk/tests/cache-bitmap.test.ts
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, vi } from 'vitest';
-import { CacheBitmap } from '../src/cacheBitmap';
+import { CacheBitmap } from '../src/render/cacheBitmap';
-vi.mock('../src/renderer', () => ({
+vi.mock('../src/render/renderer', () => ({
Renderer: {
createRenderTarget: vi.fn(() => 1),
getTargetTexture: vi.fn(() => 42),
@@ -18,7 +18,7 @@ vi.mock('../src/renderer', () => ({
},
}));
-vi.mock('../src/renderTexture', () => ({
+vi.mock('../src/render/renderTexture', () => ({
RenderTexture: {
create: vi.fn(() => ({ _handle: 1, textureId: 42, width: 256, height: 256, _depth: false, _filter: 'linear' })),
release: vi.fn(),
diff --git a/sdk/tests/camera-director.test.ts b/sdk/tests/camera-director.test.ts
index 5456d5b3f..d7ec1e491 100644
--- a/sdk/tests/camera-director.test.ts
+++ b/sdk/tests/camera-director.test.ts
@@ -14,7 +14,7 @@ import {
type CameraDirectorState,
} from '../src/camera/CameraDirector';
import type { CameraPOV } from '../src/camera/CameraPlugin';
-import { ProjectionType, ClearFlags } from '../src/component';
+import { ProjectionType, ClearFlags } from '../src/ecs/component';
const mkPOV = (over: Partial<CameraPOV>): CameraPOV => ({
entity: 0,
diff --git a/sdk/tests/camera-pov.test.ts b/sdk/tests/camera-pov.test.ts
index 392dda29e..3ec19ca33 100644
--- a/sdk/tests/camera-pov.test.ts
+++ b/sdk/tests/camera-pov.test.ts
@@ -7,7 +7,7 @@
*/
import { describe, it, expect } from 'vitest';
import { buildCameraInfo, snapToPixelGrid, type CameraPOV } from '../src/camera/CameraPlugin';
-import { ProjectionType, ClearFlags } from '../src/component';
+import { ProjectionType, ClearFlags } from '../src/ecs/component';
function ndc(vp: Float32Array, x: number, y: number) {
return { x: vp[0] * x + vp[4] * y + vp[12], y: vp[1] * x + vp[5] * y + vp[13] };
diff --git a/sdk/tests/chunk-collision.test.ts b/sdk/tests/chunk-collision.test.ts
index 4fa27220c..f0a0c3a75 100644
--- a/sdk/tests/chunk-collision.test.ts
+++ b/sdk/tests/chunk-collision.test.ts
@@ -8,7 +8,7 @@ import { describe, it, expect, vi } from 'vitest';
import { decodeTilemapChunks, CHUNK_SIZE } from '../src/tilemap/chunkCodec';
import { generateChunkCollision } from '../src/tilemap/tiledLoader';
import { BodyType } from '../src/physics/PhysicsComponents';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
import type { Entity } from '../src/types';
// Build a `tilemap_exportChunks`-format blob (base64url) for the given chunks.
diff --git a/sdk/tests/color-conversion.test.ts b/sdk/tests/color-conversion.test.ts
index af9bfba2b..238d5f25b 100644
--- a/sdk/tests/color-conversion.test.ts
+++ b/sdk/tests/color-conversion.test.ts
@@ -6,7 +6,7 @@
* slots without touching the caller's inner color objects.
*/
import { describe, expect, it } from 'vitest';
-import { convertForWasm, convertFromWasm } from '../src/ecs/BuiltinBridge';
+import { convertForWasm, convertFromWasm } from '../src/ecs/bridge/BuiltinBridge';
describe('convertFromWasm', () => {
it('returns the same outer object (zero outer allocation)', () => {
diff --git a/sdk/tests/commands.test.ts b/sdk/tests/commands.test.ts
index 6b251a71c..022d9b587 100644
--- a/sdk/tests/commands.test.ts
+++ b/sdk/tests/commands.test.ts
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, vi, beforeEach } from 'vitest';
-import { CommandsInstance, EntityCommands, Commands } from '../src/commands';
-import { defineComponent, defineBuiltin, Name } from '../src/component';
-import { defineResource, ResourceStorage } from '../src/resource';
-import type { World } from '../src/world';
+import { CommandsInstance, EntityCommands, Commands } from '../src/ecs/commands';
+import { defineComponent, defineBuiltin, Name } from '../src/ecs/component';
+import { defineResource, ResourceStorage } from '../src/ecs/resource';
+import type { World } from '../src/ecs/world';
import type { Entity } from '../src/types';
const Position = defineComponent('CmdTestPosition', { x: 0, y: 0 });
diff --git a/sdk/tests/component-asset-fields.test.ts b/sdk/tests/component-asset-fields.test.ts
index 6ec2d91e6..5c10cd58a 100644
--- a/sdk/tests/component-asset-fields.test.ts
+++ b/sdk/tests/component-asset-fields.test.ts
@@ -12,7 +12,7 @@ import { describe, it, expect } from 'vitest';
import {
Sprite, BitmapText, SpineAnimation, ParticleEmitter, TilemapLayer,
getComponent,
-} from '../src/component';
+} from '../src/ecs/component';
import { UIVisual } from '../src/ui/core/ui-visual';
import { SpriteAnimator } from '../src/animation/SpriteAnimator';
import { AudioSource } from '../src/audio/AudioComponents';
diff --git a/sdk/tests/component-fieldmeta-golden.test.ts b/sdk/tests/component-fieldmeta-golden.test.ts
index ed67bc569..46ed96c2a 100644
--- a/sdk/tests/component-fieldmeta-golden.test.ts
+++ b/sdk/tests/component-fieldmeta-golden.test.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect } from 'vitest';
-import { getComponentRegistry, getComponentFieldMeta } from '../src/component';
+import { getComponentRegistry, getComponentFieldMeta } from '../src/ecs/component';
// Equivalence gate for RC9-1 (rich reflection metadata, single authoring source).
// P2 moves the authority for builtin field presentation metadata from the
diff --git a/sdk/tests/component-id-stable.test.ts b/sdk/tests/component-id-stable.test.ts
index ba66b30c3..31d6bd1cc 100644
--- a/sdk/tests/component-id-stable.test.ts
+++ b/sdk/tests/component-id-stable.test.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
-import { defineComponent, clearUserComponents, getComponent } from '../src/component';
-import { AppContext, getDefaultContext, setDefaultContext } from '../src/context';
+import { defineComponent, clearUserComponents, getComponent } from '../src/ecs/component';
+import { AppContext, getDefaultContext, setDefaultContext } from '../src/ecs/context';
// RC10 P3 prerequisite: user component _id is interned by name (stable, module-global)
// so a re-imported project bundle resolves to the live World's existing component
diff --git a/sdk/tests/component-registry-completeness.test.ts b/sdk/tests/component-registry-completeness.test.ts
index 7bce59b4d..b424f042c 100644
--- a/sdk/tests/component-registry-completeness.test.ts
+++ b/sdk/tests/component-registry-completeness.test.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect } from 'vitest';
-import { COMPONENT_META } from '../src/component.generated';
-import { getComponent, ensureBuiltinComponentsRegistered } from '../src/component';
+import { COMPONENT_META } from '../src/ecs/component.generated';
+import { getComponent, ensureBuiltinComponentsRegistered } from '../src/ecs/component';
describe('builtin component registry completeness', () => {
it('every COMPONENT_META component is registered (no silent-drop)', () => {
diff --git a/sdk/tests/component.test.ts b/sdk/tests/component.test.ts
index cb42ad456..3ffd0daef 100644
--- a/sdk/tests/component.test.ts
+++ b/sdk/tests/component.test.ts
@@ -16,8 +16,8 @@ import {
enumOptions,
Camera,
ProjectionType,
-} from '../src/component';
-import { AppContext, getDefaultContext, setDefaultContext } from '../src/context';
+} from '../src/ecs/component';
+import { AppContext, getDefaultContext, setDefaultContext } from '../src/ecs/context';
describe('Component Registry', () => {
beforeEach(() => {
diff --git a/sdk/tests/compressed-texture.test.ts b/sdk/tests/compressed-texture.test.ts
index 22ababb89..bd57e0d2e 100644
--- a/sdk/tests/compressed-texture.test.ts
+++ b/sdk/tests/compressed-texture.test.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
-import { initResourceManager, shutdownResourceManager } from '../src/resourceManager';
+import { initResourceManager, shutdownResourceManager } from '../src/wasm/resourceManager';
import {
isKtx2,
chooseTargetFormat,
diff --git a/sdk/tests/core-bridge.test.ts b/sdk/tests/core-bridge.test.ts
index f2320dd6f..bd395ab37 100644
--- a/sdk/tests/core-bridge.test.ts
+++ b/sdk/tests/core-bridge.test.ts
@@ -8,9 +8,9 @@
* Verified directly on CoreApiBridge and end-to-end via GLDebug.
*/
import { describe, it, expect, vi, afterEach } from 'vitest';
-import { WasmModuleAborted } from '../src/moduleHealth';
-import { CoreApiBridge } from '../src/CoreApiBridge';
-import { GLDebug, initGLDebugAPI, shutdownGLDebugAPI } from '../src/glDebug';
+import { WasmModuleAborted } from '../src/wasm/moduleHealth';
+import { CoreApiBridge } from '../src/wasm/CoreApiBridge';
+import { GLDebug, initGLDebugAPI, shutdownGLDebugAPI } from '../src/render/glDebug';
import type { ESEngineModule } from '../src/wasm';
describe('CoreApiBridge', () => {
diff --git a/sdk/tests/cpp-contract.test.ts b/sdk/tests/cpp-contract.test.ts
index eaa897bf9..89b598b77 100644
--- a/sdk/tests/cpp-contract.test.ts
+++ b/sdk/tests/cpp-contract.test.ts
@@ -31,11 +31,11 @@ import { CHUNK_SIZE } from '../src/tilemap/chunkCodec';
// EHT-generated twins (the authoritative C++ ES_ENUM values) + the module-local
// names the UI/physics modules publish them under.
-import * as gen from '../src/wasm.generated';
+import * as gen from '../src/wasm/wasm.generated';
import { BodyType } from '../src/physics/PhysicsComponents';
import { UIPositionType, AlignSelf } from '../src/ui/core/ui-node';
import { UIVisualType, FillMethod, FillOrigin } from '../src/ui/core/ui-visual';
-import { ParticleEasing } from '../src/component';
+import { ParticleEasing } from '../src/ecs/component';
// Repo root is two levels up from sdk/tests/ (mirrors the spine integration tests).
const CPP = resolve(__dirname, '../../src/esengine');
diff --git a/sdk/tests/custom-draw.test.ts b/sdk/tests/custom-draw.test.ts
index 5f1ccbc7c..0e49ccf61 100644
--- a/sdk/tests/custom-draw.test.ts
+++ b/sdk/tests/custom-draw.test.ts
@@ -11,7 +11,7 @@ import {
clearDrawCallbacks,
clearSceneDrawCallbacks,
getDrawCallbacks,
-} from '../src/customDraw';
+} from '../src/render/customDraw';
describe('customDraw callback registry', () => {
beforeEach(() => {
diff --git a/sdk/tests/discoverAssets.test.ts b/sdk/tests/discoverAssets.test.ts
index 29f362ba0..375629c31 100644
--- a/sdk/tests/discoverAssets.test.ts
+++ b/sdk/tests/discoverAssets.test.ts
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
-import { defineComponent, clearUserComponents } from '../src/component';
+import { defineComponent, clearUserComponents } from '../src/ecs/component';
import { discoverSceneAssets, getAssetPathsByType } from '../src/asset/discoverAssets';
import { AssetRegistry, makeUuidRef } from '../src/asset/AssetRegistry';
import { StateMachineAgent } from '../src/ai/fsm/StateMachineAgent';
import { BehaviorTreeAgent } from '../src/ai/bt/BehaviorTreeAgent';
-import { TilemapLayer } from '../src/component';
+import { TilemapLayer } from '../src/ecs/component';
import type { SceneData } from '../src/scene';
const SPRITE_NAME = 'DiscoverTest_Sprite';
diff --git a/sdk/tests/draw.test.ts b/sdk/tests/draw.test.ts
index 28734c7ed..837fd6a7d 100644
--- a/sdk/tests/draw.test.ts
+++ b/sdk/tests/draw.test.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-vi.mock('../src/material', () => {
+vi.mock('../src/render/material', () => {
const materials = new Map();
return {
Material: {
@@ -27,8 +27,8 @@ vi.mock('../src/material', () => {
});
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
-import { Draw, initDrawAPI, shutdownDrawAPI, BlendMode } from '../src/draw';
-import { Material, isTextureRef } from '../src/material';
+import { Draw, initDrawAPI, shutdownDrawAPI, BlendMode } from '../src/render/draw';
+import { Material, isTextureRef } from '../src/render/material';
import type { ESEngineModule } from '../src/wasm';
// =============================================================================
diff --git a/sdk/tests/editor-bridge.test.ts b/sdk/tests/editor-bridge.test.ts
index e61631055..51465b693 100644
--- a/sdk/tests/editor-bridge.test.ts
+++ b/sdk/tests/editor-bridge.test.ts
@@ -8,8 +8,8 @@ import {
getComponentRegistry,
getComponent,
isBuiltinComponent,
-} from '../src/component';
-import { getDefaultContext } from '../src/context';
+} from '../src/ecs/component';
+import { getDefaultContext } from '../src/ecs/context';
/**
* Confirms that the SDK-side `editorBridge` hook and the exports the
diff --git a/sdk/tests/editor-defaults.test.ts b/sdk/tests/editor-defaults.test.ts
index 87de34e86..4216b4677 100644
--- a/sdk/tests/editor-defaults.test.ts
+++ b/sdk/tests/editor-defaults.test.ts
@@ -8,8 +8,8 @@
* is the runtime ctor truth, _default the authoring truth.
*/
import { describe, it, expect } from 'vitest';
-import { Camera, Sprite, ProjectionType } from '../src/component';
-import { COMPONENT_META } from '../src/component.generated';
+import { Camera, Sprite, ProjectionType } from '../src/ecs/component';
+import { COMPONENT_META } from '../src/ecs/component.generated';
import { DEFAULT_SPRITE_SIZE } from '../src/defaults';
describe('editor_default single-source', () => {
diff --git a/sdk/tests/editor-grid.test.ts b/sdk/tests/editor-grid.test.ts
index e78aee20a..be0a93654 100644
--- a/sdk/tests/editor-grid.test.ts
+++ b/sdk/tests/editor-grid.test.ts
@@ -17,7 +17,7 @@ import {
registerPreSceneDrawCallback,
unregisterPreSceneDrawCallback,
getPreSceneDrawCallbacks,
-} from '../src/customDraw';
+} from '../src/render/customDraw';
// Minimal App surface installEditorGrid + the grid callback actually touch.
function stubApp() {
diff --git a/sdk/tests/editor-view.test.ts b/sdk/tests/editor-view.test.ts
index 72a12ddc6..723cd9711 100644
--- a/sdk/tests/editor-view.test.ts
+++ b/sdk/tests/editor-view.test.ts
@@ -9,7 +9,7 @@
*/
import { describe, it, expect } from 'vitest';
import { editorCameraInfo } from '../src/camera/CameraPlugin';
-import { ClearFlags } from '../src/component';
+import { ClearFlags } from '../src/ecs/component';
// Apply a column-major VP matrix to a 2D world point → clip/NDC xy.
function ndc(vp: Float32Array, x: number, y: number) {
diff --git a/sdk/tests/engine-component-baseline.test.ts b/sdk/tests/engine-component-baseline.test.ts
index 2e3de46af..09db52cef 100644
--- a/sdk/tests/engine-component-baseline.test.ts
+++ b/sdk/tests/engine-component-baseline.test.ts
@@ -13,7 +13,7 @@ import { describe, it, expect } from 'vitest';
import {
defineComponent, clearUserComponents, getComponent,
getUserComponentFingerprint, markEngineComponentBaseline, seedEngineComponents,
-} from '../src/component';
+} from '../src/ecs/component';
import { probeRegistrations } from '../src/hotReload';
describe('engine component baseline survives a hot reload', () => {
diff --git a/sdk/tests/entity-generation.test.ts b/sdk/tests/entity-generation.test.ts
index 7dd175bb1..b446e02d4 100644
--- a/sdk/tests/entity-generation.test.ts
+++ b/sdk/tests/entity-generation.test.ts
@@ -5,7 +5,7 @@
* @brief Verify Entity packing helpers and World's stale-handle detection.
*/
import { describe, expect, it } from 'vitest';
-import { World } from '../src/world';
+import { World } from '../src/ecs/world';
import {
ENTITY_GEN_BITS,
ENTITY_GEN_MASK,
diff --git a/sdk/tests/entity-hierarchy.test.ts b/sdk/tests/entity-hierarchy.test.ts
index 143f3fd5a..b2e59b59e 100644
--- a/sdk/tests/entity-hierarchy.test.ts
+++ b/sdk/tests/entity-hierarchy.test.ts
@@ -7,8 +7,8 @@
* Run `node build-tools/cli.js build -t web` first if missing.
*/
import { describe, it, expect, beforeAll } from 'vitest';
-import { World } from '../src/world';
-import { Transform, Sprite, Parent, Children } from '../src/component';
+import { World } from '../src/ecs/world';
+import { Transform, Sprite, Parent, Children } from '../src/ecs/component';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
import { loadWasmModule, HAS_WASM } from './helpers/loadWasm';
diff --git a/sdk/tests/entity-order.test.ts b/sdk/tests/entity-order.test.ts
index 3f9456b10..b78c0b409 100644
--- a/sdk/tests/entity-order.test.ts
+++ b/sdk/tests/entity-order.test.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
-import { World } from '../src/world';
-import { defineComponent, defineBuiltin } from '../src/component';
+import { World } from '../src/ecs/world';
+import { defineComponent, defineBuiltin } from '../src/ecs/component';
import { rankByOrder, reorderMapByRank, reorderSetByRank, UNRANKED } from '../src/ecs/entityOrder';
import type { Entity } from '../src/types';
import { createMockModule } from './mocks/wasm';
diff --git a/sdk/tests/entity-visibility.test.ts b/sdk/tests/entity-visibility.test.ts
index ffdd1b9e6..e5bef2153 100644
--- a/sdk/tests/entity-visibility.test.ts
+++ b/sdk/tests/entity-visibility.test.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect } from 'vitest';
-import { setEntityVisible, isEntityVisible, setEntityActive, isEntityActive } from '../src/entityUtils';
+import { setEntityVisible, isEntityVisible, setEntityActive, isEntityActive } from '../src/ecs/entityUtils';
describe('Entity visibility helpers', () => {
const mockWorld = () => {
diff --git a/sdk/tests/event-binding.test.ts b/sdk/tests/event-binding.test.ts
index f0b96e4da..4b9f8c9c0 100644
--- a/sdk/tests/event-binding.test.ts
+++ b/sdk/tests/event-binding.test.ts
@@ -7,7 +7,7 @@
* bubbling from a child into an ancestor's rows.
*/
import { beforeEach, describe, expect, it } from 'vitest';
-import { EntityEventQueue } from '../src/entityEvents';
+import { EntityEventQueue } from '../src/ecs/entityEvents';
import {
EventBinding,
createEventBindingRuntime,
@@ -18,8 +18,8 @@ import {
import { Blackboard } from '../src/ai/fsm/Blackboard';
import { aiRegistry } from '../src/ai/fsm/AiContext';
import type { AiParams } from '../src/ai/fsm/registry';
-import { Children, Name, Parent } from '../src/component';
-import type { AnyComponentDef } from '../src/component';
+import { Children, Name, Parent } from '../src/ecs/component';
+import type { AnyComponentDef } from '../src/ecs/component';
import type { Entity } from '../src/types';
/** A world stub with just the slice EventBinding touches (+ hierarchy helpers). */
diff --git a/sdk/tests/event.test.ts b/sdk/tests/event.test.ts
index 9102c078c..1c2f1cc7e 100644
--- a/sdk/tests/event.test.ts
+++ b/sdk/tests/event.test.ts
@@ -11,7 +11,7 @@ import {
EventReaderInstance,
EventWriterDescriptor,
EventReaderDescriptor,
-} from '../src/event';
+} from '../src/ecs/event';
// =============================================================================
// defineEvent
diff --git a/sdk/tests/filters.test.ts b/sdk/tests/filters.test.ts
index 48a15fc0d..d244d75d9 100644
--- a/sdk/tests/filters.test.ts
+++ b/sdk/tests/filters.test.ts
@@ -1,15 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, vi, beforeEach } from 'vitest';
-import { Filters } from '../src/filters';
+import { Filters } from '../src/render/filters';
-vi.mock('../src/material', () => ({
+vi.mock('../src/render/material', () => ({
Material: {
compileShader: vi.fn(() => 42),
},
}));
-vi.mock('../src/resourceManager', () => ({
+vi.mock('../src/wasm/resourceManager', () => ({
requireResourceManager: () => ({
createMaterial: vi.fn(() => 100),
}),
diff --git a/sdk/tests/frame-capture.test.ts b/sdk/tests/frame-capture.test.ts
index 32de4edb6..8f2ccefa6 100644
--- a/sdk/tests/frame-capture.test.ts
+++ b/sdk/tests/frame-capture.test.ts
@@ -7,7 +7,7 @@
* mutation or reuse of the WASM-backed source buffer.
*/
import { describe, expect, it } from 'vitest';
-import { decodeFrameCapture, getSnapshotImageData, RenderType, FlushReason } from '../src/frameCapture';
+import { decodeFrameCapture, getSnapshotImageData, RenderType, FlushReason } from '../src/render/frameCapture';
import type { ESEngineModule } from '../src/wasm';
// Minimal ImageData shim for headless test runs. Mirrors the parts of the
diff --git a/sdk/tests/fsm-agent.test.ts b/sdk/tests/fsm-agent.test.ts
index 46db4f606..2b9ba1cef 100644
--- a/sdk/tests/fsm-agent.test.ts
+++ b/sdk/tests/fsm-agent.test.ts
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
import type { Entity } from '../src/types';
-import type { CommandsInstance } from '../src/commands';
+import type { CommandsInstance } from '../src/ecs/commands';
import { StateMachineAgent, registerFsm, clearFsmStore } from '../src/ai/fsm/StateMachineAgent';
import { aiRegistry, registerAction } from '../src/ai/fsm/AiContext';
import {
diff --git a/sdk/tests/fsm-sprite-anim.test.ts b/sdk/tests/fsm-sprite-anim.test.ts
index c83fa751e..76bdd74a9 100644
--- a/sdk/tests/fsm-sprite-anim.test.ts
+++ b/sdk/tests/fsm-sprite-anim.test.ts
@@ -18,7 +18,7 @@ import type { FsmDefinition } from '../src/ai/fsm/types';
import {
SpriteAnimator, SpriteAnimationAPI, type SpriteAnimatorData, type SpriteAnimClip,
} from '../src/animation/SpriteAnimator';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
/** A one-entity AiContext over a plain component store. */
function makeCtx(components: Map<string, unknown>): AiContext {
diff --git a/sdk/tests/fsm-timeline.test.ts b/sdk/tests/fsm-timeline.test.ts
index 2598bec68..df512d94a 100644
--- a/sdk/tests/fsm-timeline.test.ts
+++ b/sdk/tests/fsm-timeline.test.ts
@@ -9,7 +9,7 @@
*/
import { describe, it, expect, beforeEach } from 'vitest';
import type { Entity } from '../src/types';
-import type { CommandsInstance } from '../src/commands';
+import type { CommandsInstance } from '../src/ecs/commands';
import { StateMachineAgent, registerFsm, clearFsmStore } from '../src/ai/fsm/StateMachineAgent';
import { aiRegistry, registerAction } from '../src/ai/fsm/AiContext';
import { stepStateMachines, agentBlackboard, type FsmWorldView } from '../src/ai/fsm/FsmPlugin';
diff --git a/sdk/tests/fx-despawn-cleanup.test.ts b/sdk/tests/fx-despawn-cleanup.test.ts
index 451652991..d6fc1d4ae 100644
--- a/sdk/tests/fx-despawn-cleanup.test.ts
+++ b/sdk/tests/fx-despawn-cleanup.test.ts
@@ -8,13 +8,13 @@
*/
import { describe, it, expect, vi } from 'vitest';
import { App } from '../src/app';
-import { AppContext, setDefaultContext } from '../src/context';
+import { AppContext, setDefaultContext } from '../src/ecs/context';
import { setEditorMode, setPlayMode } from '../src/env';
import { createMockModule } from './mocks/wasm';
-import { Mesh2DPlugin, Meshes2D } from '../src/mesh2d';
+import { Mesh2DPlugin, Meshes2D } from '../src/render/mesh2d';
import { ParticlePlugin } from '../src/particle/ParticlePlugin';
import { TrailPlugin } from '../src/trail/TrailPlugin';
-import { TrailRenderer } from '../src/component';
+import { TrailRenderer } from '../src/ecs/component';
import type { ESEngineModule } from '../src/wasm';
// Like bootMockApp, but connects through App so plugins see app.wasmModule.
diff --git a/sdk/tests/geometry.test.ts b/sdk/tests/geometry.test.ts
index 4243c7921..288d10e92 100644
--- a/sdk/tests/geometry.test.ts
+++ b/sdk/tests/geometry.test.ts
@@ -6,8 +6,8 @@ import {
DataType,
initGeometryAPI,
shutdownGeometryAPI,
-} from '../src/geometry';
-import type { GeometryHandle } from '../src/geometry';
+} from '../src/render/geometry';
+import type { GeometryHandle } from '../src/render/geometry';
import type { ESEngineModule } from '../src/wasm';
// =============================================================================
diff --git a/sdk/tests/gesture.test.ts b/sdk/tests/gesture.test.ts
index 9314c54dd..e7756a385 100644
--- a/sdk/tests/gesture.test.ts
+++ b/sdk/tests/gesture.test.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, vi, beforeEach } from 'vitest';
-import { GestureDetector, type SwipeDirection } from '../src/gesture';
-import { InputState } from '../src/input';
+import { GestureDetector, type SwipeDirection } from '../src/input/gesture';
+import { InputState } from '../src/input/input';
describe('GestureDetector', () => {
let input: InputState;
diff --git a/sdk/tests/graphics.test.ts b/sdk/tests/graphics.test.ts
index e89550243..8d4560447 100644
--- a/sdk/tests/graphics.test.ts
+++ b/sdk/tests/graphics.test.ts
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, vi } from 'vitest';
-import { Graphics } from '../src/graphics';
+import { Graphics } from '../src/render/graphics';
-vi.mock('../src/draw', () => ({
+vi.mock('../src/render/draw', () => ({
Draw: {
line: vi.fn(),
rect: vi.fn(),
diff --git a/sdk/tests/helpers/mockApp.ts b/sdk/tests/helpers/mockApp.ts
index b376cb4e2..8cfddd996 100644
--- a/sdk/tests/helpers/mockApp.ts
+++ b/sdk/tests/helpers/mockApp.ts
@@ -13,7 +13,7 @@
* to the *-smoke.mjs runners that link the real engine.
*/
import { App } from '../../src/app';
-import { AppContext, setDefaultContext } from '../../src/context';
+import { AppContext, setDefaultContext } from '../../src/ecs/context';
import { setEditorMode, setPlayMode } from '../../src/env';
import { createMockModule } from '../mocks/wasm';
import type { ESEngineModule } from '../../src/wasm';
diff --git a/sdk/tests/hit-area.test.ts b/sdk/tests/hit-area.test.ts
index d20cd3515..356428de4 100644
--- a/sdk/tests/hit-area.test.ts
+++ b/sdk/tests/hit-area.test.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect } from 'vitest';
-import { HitAreaShape, pointInHitArea } from '../src/hitArea';
+import { HitAreaShape, pointInHitArea } from '../src/input/hitArea';
describe('HitArea', () => {
describe('rect', () => {
diff --git a/sdk/tests/hot-swap-systems.test.ts b/sdk/tests/hot-swap-systems.test.ts
index 9aefd6b21..ce153bd5d 100644
--- a/sdk/tests/hot-swap-systems.test.ts
+++ b/sdk/tests/hot-swap-systems.test.ts
@@ -2,10 +2,10 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
import { App } from '../src/app';
-import { defineSystem, Schedule } from '../src/system';
-import { defineComponent, clearUserComponents, getUserComponentFingerprint, getUserComponents } from '../src/component';
-import { setDefaultContext, AppContext } from '../src/context';
-import { addSystemToSchedule } from '../src/system';
+import { defineSystem, Schedule } from '../src/ecs/system';
+import { defineComponent, clearUserComponents, getUserComponentFingerprint, getUserComponents } from '../src/ecs/component';
+import { setDefaultContext, AppContext } from '../src/ecs/context';
+import { addSystemToSchedule } from '../src/ecs/system';
import { probeRegistrations } from '../src/hotReload';
// RC10 P3: the state-preserving hot-reload core — App.hotSwapSystems replaces user
diff --git a/sdk/tests/hot-update-runtime.test.ts b/sdk/tests/hot-update-runtime.test.ts
index 152f5deee..cb3fd54bd 100644
--- a/sdk/tests/hot-update-runtime.test.ts
+++ b/sdk/tests/hot-update-runtime.test.ts
@@ -19,7 +19,7 @@ const mockModule = {
FS: null,
} as any;
-vi.mock('../src/resourceManager', () => ({
+vi.mock('../src/wasm/resourceManager', () => ({
requireResourceManager: () => ({
createTexture: vi.fn(() => 42),
releaseTexture: vi.fn(),
diff --git a/sdk/tests/input-fixed-step.test.ts b/sdk/tests/input-fixed-step.test.ts
index a09e431b8..693c97c6f 100644
--- a/sdk/tests/input-fixed-step.test.ts
+++ b/sdk/tests/input-fixed-step.test.ts
@@ -2,9 +2,9 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect } from 'vitest';
import { App } from '../src/app';
-import { Schedule, defineSystem } from '../src/system';
-import { Res } from '../src/resource';
-import { Input, InputState } from '../src/input';
+import { Schedule, defineSystem } from '../src/ecs/system';
+import { Res } from '../src/ecs/resource';
+import { Input, InputState } from '../src/input/input';
/**
* Edge input (isKeyPressed / isMouseButtonPressed) read from a FixedUpdate-family
diff --git a/sdk/tests/input-gamepad.test.ts b/sdk/tests/input-gamepad.test.ts
index a9e263d58..cefc4a2bb 100644
--- a/sdk/tests/input-gamepad.test.ts
+++ b/sdk/tests/input-gamepad.test.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect } from 'vitest';
-import { InputState, GamepadButton, GamepadAxis } from '../src/input';
+import { InputState, GamepadButton, GamepadAxis } from '../src/input/input';
import type { GamepadSnapshot } from '../src/platform/types';
/** Build a standard-layout snapshot (17 buttons / 4 axes) with specific overrides. */
diff --git a/sdk/tests/input-map-asset.test.ts b/sdk/tests/input-map-asset.test.ts
index 307406708..690222513 100644
--- a/sdk/tests/input-map-asset.test.ts
+++ b/sdk/tests/input-map-asset.test.ts
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
-import { InputState } from '../src/input';
-import { defineInputMap, loadInputMapAsset, Axis2D, Button, Keys2D, Key } from '../src/inputMap';
-import { AppContext, setDefaultContext } from '../src/context';
+import { InputState } from '../src/input/input';
+import { defineInputMap, loadInputMapAsset, Axis2D, Button, Keys2D, Key } from '../src/input/inputMap';
+import { AppContext, setDefaultContext } from '../src/ecs/context';
beforeEach(() => setDefaultContext(new AppContext()));
diff --git a/sdk/tests/input-map-rebind.test.ts b/sdk/tests/input-map-rebind.test.ts
index 8ba7b33cc..dc8c69bc8 100644
--- a/sdk/tests/input-map-rebind.test.ts
+++ b/sdk/tests/input-map-rebind.test.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeAll } from 'vitest';
-import { InputState, GamepadButton } from '../src/input';
-import { InputMap, Button, Key } from '../src/inputMap';
+import { InputState, GamepadButton } from '../src/input/input';
+import { InputMap, Button, Key } from '../src/input/inputMap';
import type { GamepadSnapshot, PlatformAdapter } from '../src/platform/types';
import { setPlatform } from '../src/platform/base';
diff --git a/sdk/tests/input-map.test.ts b/sdk/tests/input-map.test.ts
index 8c5915027..3cbce5c6f 100644
--- a/sdk/tests/input-map.test.ts
+++ b/sdk/tests/input-map.test.ts
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect } from 'vitest';
-import { InputState, GamepadButton, GamepadAxis } from '../src/input';
+import { InputState, GamepadButton, GamepadAxis } from '../src/input/input';
import {
InputMap, Button, Axis1D, Axis2D,
Key, MouseButton, GpButton, Keys1D, Keys2D, Stick,
-} from '../src/inputMap';
+} from '../src/input/inputMap';
import type { GamepadSnapshot } from '../src/platform/types';
function pad(o: { buttons?: Record<number, number>; axes?: Record<number, number> } = {}): GamepadSnapshot {
diff --git a/sdk/tests/input-multitouch.test.ts b/sdk/tests/input-multitouch.test.ts
index f329d628e..92597d40b 100644
--- a/sdk/tests/input-multitouch.test.ts
+++ b/sdk/tests/input-multitouch.test.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
-import { InputState } from '../src/input';
+import { InputState } from '../src/input/input';
describe('InputState multi-touch', () => {
let input: InputState;
diff --git a/sdk/tests/input-router.test.ts b/sdk/tests/input-router.test.ts
index 284140984..19ad1e467 100644
--- a/sdk/tests/input-router.test.ts
+++ b/sdk/tests/input-router.test.ts
@@ -8,7 +8,7 @@
* edge that releases it). None of that was asserted.
*/
import { describe, it, expect, vi } from 'vitest';
-import { InputRouter, type InputHandler, type Modifiers } from '../src/inputRouter';
+import { InputRouter, type InputHandler, type Modifiers } from '../src/input/inputRouter';
describe('InputRouter tier ordering & consumption', () => {
it('dispatches editor before UI and stops when the editor consumes', () => {
diff --git a/sdk/tests/input.test.ts b/sdk/tests/input.test.ts
index 9ddf01893..a543defa0 100644
--- a/sdk/tests/input.test.ts
+++ b/sdk/tests/input.test.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
-import { InputState } from '../src/input';
+import { InputState } from '../src/input/input';
describe('InputState', () => {
let input: InputState;
diff --git a/sdk/tests/lifecycle.test.ts b/sdk/tests/lifecycle.test.ts
index 80fa0abfb..6124a61eb 100644
--- a/sdk/tests/lifecycle.test.ts
+++ b/sdk/tests/lifecycle.test.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach, vi } from 'vitest';
-import { LifecycleManager } from '../src/lifecycle';
+import { LifecycleManager } from '../src/ecs/lifecycle';
describe('LifecycleManager', () => {
let manager: LifecycleManager;
diff --git a/sdk/tests/locale-table.test.ts b/sdk/tests/locale-table.test.ts
index 8e52e9f74..41ea6df97 100644
--- a/sdk/tests/locale-table.test.ts
+++ b/sdk/tests/locale-table.test.ts
@@ -12,7 +12,7 @@ import { LocaleAssetLoader } from '../src/asset/loaders/LocaleAssetLoader';
import type { LoadContext } from '../src/asset/AssetLoader';
import { applyTextLocalization, type TextWorldView } from '../src/ui/text/localize';
import { Text, type TextData } from '../src/ui/core/text';
-import { sceneUsesI18n } from '../src/runtimeLoader';
+import { sceneUsesI18n } from '../src/runtime/runtimeLoader';
import type { SceneData } from '../src/scene';
import type { Entity } from '../src/types';
diff --git a/sdk/tests/loop-integration.test.ts b/sdk/tests/loop-integration.test.ts
index 1a0ba2a83..4a604cbc9 100644
--- a/sdk/tests/loop-integration.test.ts
+++ b/sdk/tests/loop-integration.test.ts
@@ -9,10 +9,10 @@
*/
import { describe, it, expect, beforeEach } from 'vitest';
import { App, flushPendingSystems } from '../src/app';
-import { Input, InputState, GamepadButton, GamepadAxis } from '../src/input';
-import { defineInputMap, Axis2D, Button, Keys2D, Stick, Key, GpButton } from '../src/inputMap';
+import { Input, InputState, GamepadButton, GamepadAxis } from '../src/input/input';
+import { defineInputMap, Axis2D, Button, Keys2D, Stick, Key, GpButton } from '../src/input/inputMap';
import { defineBehavior } from '../src/behavior';
-import { AppContext, setDefaultContext } from '../src/context';
+import { AppContext, setDefaultContext } from '../src/ecs/context';
import type { GamepadSnapshot } from '../src/platform/types';
beforeEach(() => setDefaultContext(new AppContext()));
diff --git a/sdk/tests/marker-component.test.ts b/sdk/tests/marker-component.test.ts
index a9227c435..40801bb7e 100644
--- a/sdk/tests/marker-component.test.ts
+++ b/sdk/tests/marker-component.test.ts
@@ -7,8 +7,8 @@
* field, and be query-able like any component — the object-authoring foundation.
*/
import { describe, it, expect } from 'vitest';
-import { World } from '../src/world';
-import { Transform, Marker, markEngineComponentBaseline, seedEngineComponents } from '../src/component';
+import { World } from '../src/ecs/world';
+import { Transform, Marker, markEngineComponentBaseline, seedEngineComponents } from '../src/ecs/component';
import { serializeScene } from '../src/scene';
import { createMockModule } from './mocks/wasm';
diff --git a/sdk/tests/material-asset-loader.test.ts b/sdk/tests/material-asset-loader.test.ts
index 28012c91e..e5e6be557 100644
--- a/sdk/tests/material-asset-loader.test.ts
+++ b/sdk/tests/material-asset-loader.test.ts
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, vi, beforeEach } from 'vitest';
-vi.mock('../src/material', () => ({
+vi.mock('../src/render/material', () => ({
Material: {
createFromAsset: vi.fn().mockReturnValue(11),
setUniform: vi.fn(),
@@ -13,7 +13,7 @@ vi.mock('../src/material', () => ({
}));
import { MaterialAssetLoader } from '../src/asset/loaders/MaterialAssetLoader';
-import { Material } from '../src/material';
+import { Material } from '../src/render/material';
import type { LoadContext } from '../src/asset/AssetLoader';
const MAT_PATH = 'assets/materials/foo.esmaterial';
diff --git a/sdk/tests/material.test.ts b/sdk/tests/material.test.ts
index 38b0457db..e62753d98 100644
--- a/sdk/tests/material.test.ts
+++ b/sdk/tests/material.test.ts
@@ -8,16 +8,16 @@ import {
initMaterialAPI,
shutdownMaterialAPI,
CullMode,
-} from '../src/material';
+} from '../src/render/material';
import type {
MaterialHandle,
ShaderHandle,
TextureRef,
MaterialAssetData,
-} from '../src/material';
+} from '../src/render/material';
import type { ESEngineModule } from '../src/wasm';
-import { BlendMode } from '../src/blend';
-import { initResourceManager, shutdownResourceManager } from '../src/resourceManager';
+import { BlendMode } from '../src/render/blend';
+import { initResourceManager, shutdownResourceManager } from '../src/wasm/resourceManager';
// =============================================================================
// Mock WASM module for Material API
diff --git a/sdk/tests/materialGraph.test.ts b/sdk/tests/materialGraph.test.ts
index f1e50fa12..419804b00 100644
--- a/sdk/tests/materialGraph.test.ts
+++ b/sdk/tests/materialGraph.test.ts
@@ -11,7 +11,7 @@ import {
moveNode,
NODE_SPECS,
type MaterialGraph,
-} from '../src/materialGraph';
+} from '../src/render/materialGraph';
// TextureSample(u_albedo) × ConstColor(u_tint) → Output — a tint material as a graph.
const tintGraph: MaterialGraph = {
diff --git a/sdk/tests/memory-provider.test.ts b/sdk/tests/memory-provider.test.ts
index 9d7a257f8..49782c486 100644
--- a/sdk/tests/memory-provider.test.ts
+++ b/sdk/tests/memory-provider.test.ts
@@ -12,10 +12,10 @@
* the same input — the crux of "one SDK, two backends". No device.
*/
import { describe, expect, it } from 'vitest';
-import { BuiltinBridge } from '../src/ecs/BuiltinBridge';
-import { NativeMemoryProvider } from '../src/ecs/memoryProvider';
-import { PTR_LAYOUTS } from '../src/ptrLayouts.generated';
-import { PTR_ACCESSORS } from '../src/ecs/ptrAccessors.generated';
+import { BuiltinBridge } from '../src/ecs/bridge/BuiltinBridge';
+import { NativeMemoryProvider } from '../src/ecs/bridge/memoryProvider';
+import { PTR_LAYOUTS } from '../src/wasm/ptrLayouts.generated';
+import { PTR_ACCESSORS } from '../src/ecs/bridge/ptrAccessors.generated';
import type { CppRegistry, ESEngineModule } from '../src/wasm';
const CPP = 'Sprite';
diff --git a/sdk/tests/module-health.test.ts b/sdk/tests/module-health.test.ts
index b52d0be34..8636a5f24 100644
--- a/sdk/tests/module-health.test.ts
+++ b/sdk/tests/module-health.test.ts
@@ -9,10 +9,10 @@ import { describe, it, expect, vi } from 'vitest';
import {
WasmModuleAborted, markModuleAborted, isModuleAborted,
throwIfModuleAborted, installAbortGuard,
-} from '../src/moduleHealth';
-import { handleWasmError } from '../src/wasmError';
-import { BuiltinBridge } from '../src/ecs/BuiltinBridge';
-import { COMPONENT_META, ABI_LAYOUT_HASH } from '../src/component.generated';
+} from '../src/wasm/moduleHealth';
+import { handleWasmError } from '../src/wasm/wasmError';
+import { BuiltinBridge } from '../src/ecs/bridge/BuiltinBridge';
+import { COMPONENT_META, ABI_LAYOUT_HASH } from '../src/ecs/component.generated';
import type { CppRegistry, ESEngineModule } from '../src/wasm';
import type { Entity } from '../src/types';
diff --git a/sdk/tests/native-app-input.test.ts b/sdk/tests/native-app-input.test.ts
index a0cc246b8..c8ef4a680 100644
--- a/sdk/tests/native-app-input.test.ts
+++ b/sdk/tests/native-app-input.test.ts
@@ -8,8 +8,8 @@
* inputPlugin -> native adapter -> Input resource path, headless.
*/
import { describe, expect, it } from 'vitest';
-import { createNativeApp } from '../src/ecs/nativeRuntime';
-import { Input } from '../src/input';
+import { createNativeApp } from '../src/ecs/bridge/nativeRuntime';
+import { Input } from '../src/input/input';
import type { NativeBridge, NativeInputListener } from '../src/platform/native/bridge';
/** A NativeBridge whose registerInput captures the engine's listener; everything
diff --git a/sdk/tests/native-assets.test.ts b/sdk/tests/native-assets.test.ts
index d066c9142..772b190aa 100644
--- a/sdk/tests/native-assets.test.ts
+++ b/sdk/tests/native-assets.test.ts
@@ -11,10 +11,10 @@
* headless.
*/
import { afterEach, describe, expect, it, vi } from 'vitest';
-import { createNativeApp } from '../src/ecs/nativeRuntime';
-import { createNativeResourceManager } from '../src/ecs/nativeResourceManager';
+import { createNativeApp } from '../src/ecs/bridge/nativeRuntime';
+import { createNativeResourceManager } from '../src/ecs/bridge/nativeResourceManager';
import { Assets } from '../src/asset/AssetPlugin';
-import { shutdownResourceManager } from '../src/resourceManager';
+import { shutdownResourceManager } from '../src/wasm/resourceManager';
import { setPlatform } from '../src/platform/base';
import type { NativeBridge } from '../src/platform/native/bridge';
diff --git a/sdk/tests/native-audio.test.ts b/sdk/tests/native-audio.test.ts
index 55dbfe599..2ab2152c2 100644
--- a/sdk/tests/native-audio.test.ts
+++ b/sdk/tests/native-audio.test.ts
@@ -14,7 +14,7 @@ import { NativeAudioBackend } from '../src/audio/NativeAudioBackend';
import {
AUDIO_BINDINGS, hasAudioBindings,
REGISTRY_BINDINGS, RESOURCE_BINDINGS, PLATFORM_BINDINGS,
-} from '../src/ecs/nativeBindings';
+} from '../src/ecs/bridge/nativeBindings';
function hostGlobals(): Record<string, unknown> {
return {
diff --git a/sdk/tests/native-heap.test.ts b/sdk/tests/native-heap.test.ts
index dd60d0529..e29af3392 100644
--- a/sdk/tests/native-heap.test.ts
+++ b/sdk/tests/native-heap.test.ts
@@ -7,7 +7,7 @@
// (native/host/bindings/HeapBindings.cpp) — so the marshalling that physics,
// tilemaps and particles rely on is checked without a device.
import { describe, it, expect } from 'vitest';
-import { createNativeHeap, hasHeapBindings, HEAP_BINDINGS } from '../src/ecs/nativeHeap';
+import { createNativeHeap, hasHeapBindings, HEAP_BINDINGS } from '../src/ecs/bridge/nativeHeap';
/** A mock host arena: one buffer plus a bump allocator, offsets never 0. */
function mockHost(bytes = 1024): Record<string, unknown> {
diff --git a/sdk/tests/native-host-bridge.test.ts b/sdk/tests/native-host-bridge.test.ts
index 6e1aa8e1c..606b579e3 100644
--- a/sdk/tests/native-host-bridge.test.ts
+++ b/sdk/tests/native-host-bridge.test.ts
@@ -8,7 +8,7 @@
*/
import { describe, it, expect, vi } from 'vitest';
import { createHostBridge, assertHostEnvironment, assertNativeHost } from '../src/platform/native';
-import { REGISTRY_BINDINGS, RESOURCE_BINDINGS, PLATFORM_BINDINGS } from '../src/ecs/nativeBindings';
+import { REGISTRY_BINDINGS, RESOURCE_BINDINGS, PLATFORM_BINDINGS } from '../src/ecs/bridge/nativeBindings';
/** The globals a real host installs (console, timers, clock, decoder). */
function hostGlobals(): Record<string, unknown> {
diff --git a/sdk/tests/native-registry.test.ts b/sdk/tests/native-registry.test.ts
index 65b8eee77..7cff8a93f 100644
--- a/sdk/tests/native-registry.test.ts
+++ b/sdk/tests/native-registry.test.ts
@@ -9,11 +9,11 @@
* device — proving Stage A: one SDK, native core.
*/
import { describe, expect, it } from 'vitest';
-import { BuiltinBridge } from '../src/ecs/BuiltinBridge';
-import { createNativeRegistry } from '../src/ecs/nativeRegistry';
-import { NativeMemoryProvider } from '../src/ecs/memoryProvider';
-import { PTR_ACCESSORS } from '../src/ecs/ptrAccessors.generated';
-import { Sprite } from '../src/component';
+import { BuiltinBridge } from '../src/ecs/bridge/BuiltinBridge';
+import { createNativeRegistry } from '../src/ecs/bridge/nativeRegistry';
+import { NativeMemoryProvider } from '../src/ecs/bridge/memoryProvider';
+import { PTR_ACCESSORS } from '../src/ecs/bridge/ptrAccessors.generated';
+import { Sprite } from '../src/ecs/component';
/**
* A fake native host: each component's storage is an entity->ArrayBuffer map, with
diff --git a/sdk/tests/native-side-modules.test.ts b/sdk/tests/native-side-modules.test.ts
index cebb4b9d2..6347198af 100644
--- a/sdk/tests/native-side-modules.test.ts
+++ b/sdk/tests/native-side-modules.test.ts
@@ -11,8 +11,8 @@
import { describe, it, expect, vi } from 'vitest';
import {
createNativeSideModules, NATIVE_SIDE_MODULE_PROBES, SPINE_VERSION_BINDING,
-} from '../src/ecs/nativeSideModules';
-import { HEAP_BINDINGS } from '../src/ecs/nativeHeap';
+} from '../src/ecs/bridge/nativeSideModules';
+import { HEAP_BINDINGS } from '../src/ecs/bridge/nativeHeap';
import type { PhysicsWasmModule } from '../src/physics/PhysicsModuleLoader';
import { wrapDragonBonesModule } from '../src/dragonbones/DragonBonesModuleLoader';
import type { DragonBonesWasmModule } from '../src/dragonbones/DragonBonesModuleLoader';
diff --git a/sdk/tests/native-text.test.ts b/sdk/tests/native-text.test.ts
index 1864c0c31..cabeb02a9 100644
--- a/sdk/tests/native-text.test.ts
+++ b/sdk/tests/native-text.test.ts
@@ -13,14 +13,14 @@
* only presents afterwards.
*/
import { afterEach, describe, expect, it, vi } from 'vitest';
-import { createNativeApp } from '../src/ecs/nativeRuntime';
-import { shutdownResourceManager } from '../src/resourceManager';
+import { createNativeApp } from '../src/ecs/bridge/nativeRuntime';
+import { shutdownResourceManager } from '../src/wasm/resourceManager';
import { setPlatform } from '../src/platform/base';
-import { setRendererBackend } from '../src/renderer';
+import { setRendererBackend } from '../src/render/renderer';
import { setNativeTextSubmit, TEXT_VERTEX_FLOATS } from '../src/ui/text/submit';
-import { Camera, Canvas, Transform } from '../src/component';
+import { Camera, Canvas, Transform } from '../src/ecs/component';
import { Text, TextRenderMode } from '../src/ui/core/text';
-import { PTR_ACCESSORS } from '../src/ecs/ptrAccessors.generated';
+import { PTR_ACCESSORS } from '../src/ecs/bridge/ptrAccessors.generated';
import type { PlatformGlyphRequest } from '../src/platform/types';
import type { NativeBridge } from '../src/platform/native/bridge';
diff --git a/sdk/tests/native-world.test.ts b/sdk/tests/native-world.test.ts
index 4808bfca0..ed8afb7f7 100644
--- a/sdk/tests/native-world.test.ts
+++ b/sdk/tests/native-world.test.ts
@@ -9,9 +9,9 @@
* registry + memory backend end-to-end, headless, no device.
*/
import { describe, expect, it } from 'vitest';
-import { createNativeWorld } from '../src/ecs/nativeRuntime';
-import { PTR_ACCESSORS } from '../src/ecs/ptrAccessors.generated';
-import { Sprite, Transform } from '../src/component';
+import { createNativeWorld } from '../src/ecs/bridge/nativeRuntime';
+import { PTR_ACCESSORS } from '../src/ecs/bridge/ptrAccessors.generated';
+import { Sprite, Transform } from '../src/ecs/component';
/** A self-contained fake native ECS + the host bindings createNativeWorld expects. */
function mockNativeEcs() {
diff --git a/sdk/tests/nav-step.test.ts b/sdk/tests/nav-step.test.ts
index a68d0471b..534977f96 100644
--- a/sdk/tests/nav-step.test.ts
+++ b/sdk/tests/nav-step.test.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect } from 'vitest';
-import { Transform } from '../src/component';
+import { Transform } from '../src/ecs/component';
import type { Entity } from '../src/types';
import { NavGrid } from '../src/ai/nav/NavGrid';
import { Navigation } from '../src/ai/nav/Navigation';
diff --git a/sdk/tests/packaged-runtime-address.test.ts b/sdk/tests/packaged-runtime-address.test.ts
index e9a38fa91..b29a87fd9 100644
--- a/sdk/tests/packaged-runtime-address.test.ts
+++ b/sdk/tests/packaged-runtime-address.test.ts
@@ -6,7 +6,7 @@
* build hid — the directory a Spine atlas names its page PNG relative to.
*/
import { describe, it, expect } from 'vitest';
-import { indexPackagedManifest, createPackagedAssetSource } from '../src/packagedRuntime';
+import { indexPackagedManifest, createPackagedAssetSource } from '../src/runtime/packagedRuntime';
import type { AddressableManifest } from '../src/asset/AddressableManifest';
// A content-addressed pack: the atlas and its page PNG are staged under hashed
diff --git a/sdk/tests/particle.test.ts b/sdk/tests/particle.test.ts
index 711b3c385..c05d29cef 100644
--- a/sdk/tests/particle.test.ts
+++ b/sdk/tests/particle.test.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect } from 'vitest';
-import { getComponent } from '../src/component';
+import { getComponent } from '../src/ecs/component';
describe('ParticleEmitter Component', () => {
it('should be registered as a builtin component', () => {
@@ -68,7 +68,7 @@ describe('ParticleEmitter Component', () => {
describe('Particle Enums', () => {
it('should export EmitterShape constants', async () => {
- const { EmitterShape } = await import('../src/component');
+ const { EmitterShape } = await import('../src/ecs/component');
expect(EmitterShape.Point).toBe(0);
expect(EmitterShape.Circle).toBe(1);
expect(EmitterShape.Rectangle).toBe(2);
@@ -76,7 +76,7 @@ describe('Particle Enums', () => {
});
it('should export SimulationSpace constants', async () => {
- const { SimulationSpace } = await import('../src/component');
+ const { SimulationSpace } = await import('../src/ecs/component');
expect(SimulationSpace.World).toBe(0);
expect(SimulationSpace.Local).toBe(1);
});
diff --git a/sdk/tests/perception-step.test.ts b/sdk/tests/perception-step.test.ts
index bfa3870e5..3bb30c931 100644
--- a/sdk/tests/perception-step.test.ts
+++ b/sdk/tests/perception-step.test.ts
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect } from 'vitest';
-import { Transform } from '../src/component';
+import { Transform } from '../src/ecs/component';
import type { Entity } from '../src/types';
-import type { AnyComponentDef, ComponentData } from '../src/component';
+import type { AnyComponentDef, ComponentData } from '../src/ecs/component';
import { Perceiver, Perception, PerceptionTarget } from '../src/ai/perception/components';
import { stepPerception, type PerceptionWorldView } from '../src/ai/perception/PerceptionPlugin';
diff --git a/sdk/tests/physics-event-bridge.test.ts b/sdk/tests/physics-event-bridge.test.ts
index f96308218..6f2c1e116 100644
--- a/sdk/tests/physics-event-bridge.test.ts
+++ b/sdk/tests/physics-event-bridge.test.ts
@@ -7,7 +7,7 @@
* button, with the same queue and the same dispatcher.
*/
import { describe, expect, it, vi } from 'vitest';
-import { EntityEventQueue, EntityEvents } from '../src/entityEvents';
+import { EntityEventQueue, EntityEvents } from '../src/ecs/entityEvents';
import { PhysicsEventType, registerPhysicsEventBridge, type PhysicsContactEventData } from '../src/physics/PhysicsEventBridge';
import { PhysicsEvents, type PhysicsEventsData } from '../src/physics/PhysicsTypes';
import type { Entity } from '../src/types';
diff --git a/sdk/tests/physics-features.test.ts b/sdk/tests/physics-features.test.ts
index 7196f19d3..b7dde3a2f 100644
--- a/sdk/tests/physics-features.test.ts
+++ b/sdk/tests/physics-features.test.ts
@@ -7,7 +7,7 @@
* defaults, registration, and MotorJoint's place in the joint reconcile.
*/
import { describe, it, expect } from 'vitest';
-import { World } from '../src/world';
+import { World } from '../src/ecs/world';
import { createMockModule } from './mocks/wasm';
import {
OneWayPlatform, MotorJoint,
diff --git a/sdk/tests/physicsDebugDraw.test.ts b/sdk/tests/physicsDebugDraw.test.ts
index bbbf0e2b1..5e9194fe7 100644
--- a/sdk/tests/physicsDebugDraw.test.ts
+++ b/sdk/tests/physicsDebugDraw.test.ts
@@ -8,12 +8,12 @@ import {
type PhysicsDebugDrawConfig,
} from '../src/physics/PhysicsDebugDraw';
import { BodyType } from '../src/physics/PhysicsComponents';
-import { defineResource } from '../src/resource';
-import type { ResourceDef } from '../src/resource';
-import { clearDrawCallbacks, getDrawCallbacks } from '../src/customDraw';
-import { clearUserComponents } from '../src/component';
+import { defineResource } from '../src/ecs/resource';
+import type { ResourceDef } from '../src/ecs/resource';
+import { clearDrawCallbacks, getDrawCallbacks } from '../src/render/customDraw';
+import { clearUserComponents } from '../src/ecs/component';
-vi.mock('../src/draw', () => ({
+vi.mock('../src/render/draw', () => ({
Draw: {
line: vi.fn(),
circle: vi.fn(),
@@ -23,7 +23,7 @@ vi.mock('../src/draw', () => ({
},
}));
-import { Draw } from '../src/draw';
+import { Draw } from '../src/render/draw';
interface MockEntity {
components: Map<string, any>;
diff --git a/sdk/tests/physicsReconcile.test.ts b/sdk/tests/physicsReconcile.test.ts
index 7a2e83577..d7f2c09ba 100644
--- a/sdk/tests/physicsReconcile.test.ts
+++ b/sdk/tests/physicsReconcile.test.ts
@@ -7,7 +7,7 @@
* jointChangedOrGone (a tracked joint's component removed or edited).
*/
import { describe, it, expect } from 'vitest';
-import { World } from '../src/world';
+import { World } from '../src/ecs/world';
import { createMockModule } from './mocks/wasm';
import {
BoxCollider, CircleCollider, CapsuleCollider, RevoluteJoint,
diff --git a/sdk/tests/physicsSyncTransforms.test.ts b/sdk/tests/physicsSyncTransforms.test.ts
index a45e682ac..c231d9710 100644
--- a/sdk/tests/physicsSyncTransforms.test.ts
+++ b/sdk/tests/physicsSyncTransforms.test.ts
@@ -3,11 +3,11 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import type { Entity } from '../src/types';
import type { PhysicsWasmModule } from '../src/physics/PhysicsModuleLoader';
-import type { TransformData, ParentData } from '../src/component';
-import { Transform, Parent } from '../src/component';
+import type { TransformData, ParentData } from '../src/ecs/component';
+import { Transform, Parent } from '../src/ecs/component';
import { applyPhysicsTransforms } from '../src/physics/PhysicsSystem';
import { createMockModule } from './mocks/wasm';
-import { World } from '../src/world';
+import { World } from '../src/ecs/world';
// Publish the module's pose buffer to Transforms. The lerp itself lives in the
// physics module (see PhysicsModuleEntry.cpp / physics_interpolation doctests);
diff --git a/sdk/tests/play-asset-ref.test.ts b/sdk/tests/play-asset-ref.test.ts
index 6ab71340b..3f81795bc 100644
--- a/sdk/tests/play-asset-ref.test.ts
+++ b/sdk/tests/play-asset-ref.test.ts
@@ -5,7 +5,7 @@
* paths (spine skel/atlas, …) → the project root, not the play subdir.
*/
import { describe, it, expect } from 'vitest';
-import { resolvePlayAssetRef } from '../src/playRealmRuntime';
+import { resolvePlayAssetRef } from '../src/runtime/playRealmRuntime';
const MANIFEST = { 'aaaa': 'estella://project/assets/textures/hero.png' };
const BASE = 'estella://project';
diff --git a/sdk/tests/play-realm-asset-ref.test.ts b/sdk/tests/play-realm-asset-ref.test.ts
index a7b73d85f..078276879 100644
--- a/sdk/tests/play-realm-asset-ref.test.ts
+++ b/sdk/tests/play-realm-asset-ref.test.ts
@@ -9,7 +9,7 @@
* step must resolve the ref before lookup.
*/
import { describe, it, expect, beforeEach } from 'vitest';
-import { resolvePlayAssetRef } from '../src/playRealmRuntime';
+import { resolvePlayAssetRef } from '../src/runtime/playRealmRuntime';
import { registerFsm, getFsm, clearFsmStore, StateMachineAgent } from '../src/ai/fsm/StateMachineAgent';
import { stepStateMachines } from '../src/ai/fsm/FsmPlugin';
diff --git a/sdk/tests/playable-cta.test.ts b/sdk/tests/playable-cta.test.ts
index 46dfa8419..fa81be17b 100644
--- a/sdk/tests/playable-cta.test.ts
+++ b/sdk/tests/playable-cta.test.ts
@@ -6,7 +6,7 @@
* no bridge must stay playable rather than throw.
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
-import { playableCta, hasPlayableCta } from '../src/playableCta';
+import { playableCta, hasPlayableCta } from '../src/runtime/playableCta';
const KEY = '__ESTELLA_PLAYABLE__';
const g = globalThis as Record<string, unknown>;
diff --git a/sdk/tests/playableRuntime.test.ts b/sdk/tests/playableRuntime.test.ts
index 1f2a7e6a3..58330344e 100644
--- a/sdk/tests/playableRuntime.test.ts
+++ b/sdk/tests/playableRuntime.test.ts
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, vi, beforeEach } from 'vitest';
-vi.mock('../src/runtimeLoader', () => ({
+vi.mock('../src/runtime/runtimeLoader', () => ({
initRuntime: vi.fn().mockResolvedValue(undefined),
}));
@@ -10,9 +10,9 @@ vi.mock('../src/asset/AssetPlugin', () => ({
Assets: Symbol('Assets'),
}));
-import { initPlayableRuntime } from '../src/playableRuntime';
-import type { PlayableRuntimeConfig } from '../src/playableRuntime';
-import { initRuntime } from '../src/runtimeLoader';
+import { initPlayableRuntime } from '../src/runtime/playableRuntime';
+import type { PlayableRuntimeConfig } from '../src/runtime/playableRuntime';
+import { initRuntime } from '../src/runtime/runtimeLoader';
import { Assets } from '../src/asset/AssetPlugin';
function createMockConfig(overrides?: Partial<PlayableRuntimeConfig>): PlayableRuntimeConfig {
diff --git a/sdk/tests/postProcessPlugin.test.ts b/sdk/tests/postProcessPlugin.test.ts
index 2717b0c4d..d4152a94b 100644
--- a/sdk/tests/postProcessPlugin.test.ts
+++ b/sdk/tests/postProcessPlugin.test.ts
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, vi, beforeEach } from 'vitest';
-vi.mock('../src/material', () => ({
+vi.mock('../src/render/material', () => ({
Material: {
createShader: vi.fn().mockReturnValue(42),
releaseShader: vi.fn(),
diff --git a/sdk/tests/postprocess.test.ts b/sdk/tests/postprocess.test.ts
index e90dc6327..760ca4ffa 100644
--- a/sdk/tests/postprocess.test.ts
+++ b/sdk/tests/postprocess.test.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-vi.mock('../src/material', () => ({
+vi.mock('../src/render/material', () => ({
Material: {
createShader: vi.fn().mockReturnValue(42),
compileShader: vi.fn().mockReturnValue(42),
@@ -10,7 +10,7 @@ vi.mock('../src/material', () => ({
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import { PostProcessAPI, PostProcessStack, postProcessEffects, initPostProcessAPI, shutdownPostProcessAPI, getEffectDef } from '../src/postprocess';
-import { Material } from '../src/material';
+import { Material } from '../src/render/material';
import type { ESEngineModule } from '../src/wasm';
// =============================================================================
diff --git a/sdk/tests/prefab-rigor.test.ts b/sdk/tests/prefab-rigor.test.ts
index 61db65a9e..e481cff7f 100644
--- a/sdk/tests/prefab-rigor.test.ts
+++ b/sdk/tests/prefab-rigor.test.ts
@@ -32,7 +32,7 @@ import {
applyDeltaToSource,
} from '../src/prefab/index';
import type { FlattenContext, PrefabInstanceDelta } from '../src/prefab/index';
-import { defineComponent } from '../src/component';
+import { defineComponent } from '../src/ecs/component';
// ─── Shared fixtures for hierarchical-address / structural-deletion suites ───
diff --git a/sdk/tests/prefab-validate.test.ts b/sdk/tests/prefab-validate.test.ts
index 3844eb083..4d4c80259 100644
--- a/sdk/tests/prefab-validate.test.ts
+++ b/sdk/tests/prefab-validate.test.ts
@@ -9,7 +9,7 @@
import { describe, it, expect } from 'vitest';
import type { PrefabData, PrefabDiagnostic } from '../src/prefab/index';
import { validatePrefab, PREFAB_FORMAT_VERSION } from '../src/prefab/index';
-import { defineComponent } from '../src/component';
+import { defineComponent } from '../src/ecs/component';
function clean(): PrefabData {
return {
diff --git a/sdk/tests/prefab.test.ts b/sdk/tests/prefab.test.ts
index 1fe529a5f..3ba1905e0 100644
--- a/sdk/tests/prefab.test.ts
+++ b/sdk/tests/prefab.test.ts
@@ -3,7 +3,7 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import type { PrefabData, PrefabOverride, InstantiatePrefabOptions } from '../src/prefab';
import type { SceneData } from '../src/scene';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
import type { Entity } from '../src/types';
vi.mock('../src/scene', async (importOriginal) => {
@@ -16,7 +16,7 @@ vi.mock('../src/scene', async (importOriginal) => {
import { instantiatePrefab } from '../src/prefab';
import { loadSceneWithAssets } from '../src/scene';
-import { defineComponent } from '../src/component';
+import { defineComponent } from '../src/ecs/component';
const mockLoadScene = vi.mocked(loadSceneWithAssets);
diff --git a/sdk/tests/preload-ai-assets.test.ts b/sdk/tests/preload-ai-assets.test.ts
index 272c05285..ee3e2db1a 100644
--- a/sdk/tests/preload-ai-assets.test.ts
+++ b/sdk/tests/preload-ai-assets.test.ts
@@ -18,13 +18,13 @@ import { Assets } from '../src/asset/Assets';
import { Catalog } from '../src/asset/Catalog';
import type { Backend } from '../src/asset/Backend';
import type { SceneData } from '../src/scene';
-import { defineComponent } from '../src/component';
+import { defineComponent } from '../src/ecs/component';
import { getFsm, clearFsmStore } from '../src/ai/fsm/StateMachineAgent';
import { getBt, clearBtStore } from '../src/ai/bt/BehaviorTreeAgent';
// The FSM/BT loaders don't touch the ResourceManager, but the shared LoadContext
// materializes it eagerly — stub it so the load path runs headless.
-vi.mock('../src/resourceManager', () => ({
+vi.mock('../src/wasm/resourceManager', () => ({
requireResourceManager: () => ({}),
evictTextureDimensions: vi.fn(),
}));
diff --git a/sdk/tests/preload-texture-import.test.ts b/sdk/tests/preload-texture-import.test.ts
index 516047486..c5d6aa207 100644
--- a/sdk/tests/preload-texture-import.test.ts
+++ b/sdk/tests/preload-texture-import.test.ts
@@ -17,10 +17,10 @@ import { Assets } from '../src/asset/Assets';
import { Catalog } from '../src/asset/Catalog';
import type { Backend } from '../src/asset/Backend';
import type { SceneData } from '../src/scene';
-import { defineComponent } from '../src/component';
+import { defineComponent } from '../src/ecs/component';
const setTextureMetadata = vi.fn();
-vi.mock('../src/resourceManager', () => ({
+vi.mock('../src/wasm/resourceManager', () => ({
requireResourceManager: () => ({
createTexture: vi.fn(() => 7),
registerExternalTexture: vi.fn(() => 7),
diff --git a/sdk/tests/ptr-bounds.test.ts b/sdk/tests/ptr-bounds.test.ts
index f0cc153df..0c9dcee5a 100644
--- a/sdk/tests/ptr-bounds.test.ts
+++ b/sdk/tests/ptr-bounds.test.ts
@@ -5,7 +5,7 @@
* @brief BuiltinBridge pointer helpers reject out-of-bounds access.
*/
import { describe, expect, it } from 'vitest';
-import { fillPtrFields, readPtrField, writePtrField } from '../src/ecs/BuiltinBridge';
+import { fillPtrFields, readPtrField, writePtrField } from '../src/ecs/bridge/BuiltinBridge';
function makeHeap(size = 64) {
const buffer = new ArrayBuffer(size);
diff --git a/sdk/tests/query-filter.test.ts b/sdk/tests/query-filter.test.ts
index 9b98bda48..b75b262f6 100644
--- a/sdk/tests/query-filter.test.ts
+++ b/sdk/tests/query-filter.test.ts
@@ -5,9 +5,9 @@
* @brief Composable filter predicates (With/Without/And/Or/Not) on Query.
*/
import { describe, expect, it, beforeEach } from 'vitest';
-import { World } from '../src/world';
-import { defineComponent, defineTag } from '../src/component';
-import { Query, QueryInstance, With, Without, And, Or, Not } from '../src/query';
+import { World } from '../src/ecs/world';
+import { defineComponent, defineTag } from '../src/ecs/component';
+import { Query, QueryInstance, With, Without, And, Or, Not } from '../src/ecs/query';
const Position = defineComponent('F_Position', { x: 0, y: 0 });
const Health = defineComponent('F_Health', { hp: 100 });
diff --git a/sdk/tests/query-iteration-protection.test.ts b/sdk/tests/query-iteration-protection.test.ts
index 6374dbbb4..1ac98bf31 100644
--- a/sdk/tests/query-iteration-protection.test.ts
+++ b/sdk/tests/query-iteration-protection.test.ts
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
-import { World } from '../src/world';
-import { Query, QueryInstance, Mut } from '../src/query';
-import { defineComponent } from '../src/component';
+import { World } from '../src/ecs/world';
+import { Query, QueryInstance, Mut } from '../src/ecs/query';
+import { defineComponent } from '../src/ecs/component';
describe('Query Iteration Protection', () => {
let world: World;
diff --git a/sdk/tests/query-mut-change-tracking.test.ts b/sdk/tests/query-mut-change-tracking.test.ts
index 1499312d1..aa452c092 100644
--- a/sdk/tests/query-mut-change-tracking.test.ts
+++ b/sdk/tests/query-mut-change-tracking.test.ts
@@ -11,9 +11,9 @@
* runtime. This is the regression guard for that unified behaviour.
*/
import { describe, it, expect } from 'vitest';
-import { World } from '../src/world';
-import { Query, QueryInstance, Mut, Changed } from '../src/query';
-import { Transform, type TransformData } from '../src/component';
+import { World } from '../src/ecs/world';
+import { Query, QueryInstance, Mut, Changed } from '../src/ecs/query';
+import { Transform, type TransformData } from '../src/ecs/component';
import type { Entity } from '../src/types';
import { createMockModule } from './mocks/wasm';
diff --git a/sdk/tests/query.test.ts b/sdk/tests/query.test.ts
index ed35fcb32..63c59ed4e 100644
--- a/sdk/tests/query.test.ts
+++ b/sdk/tests/query.test.ts
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
-import { World } from '../src/world';
+import { World } from '../src/ecs/world';
import {
Query, QueryInstance, Mut,
Added, Changed, Removed,
isMutWrapper, isAddedWrapper, isChangedWrapper,
RemovedQueryInstance,
-} from '../src/query';
-import { defineComponent } from '../src/component';
+} from '../src/ecs/query';
+import { defineComponent } from '../src/ecs/component';
describe('Query System', () => {
diff --git a/sdk/tests/renderPipeline.test.ts b/sdk/tests/renderPipeline.test.ts
index 4cddd7118..5d672affe 100644
--- a/sdk/tests/renderPipeline.test.ts
+++ b/sdk/tests/renderPipeline.test.ts
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach, vi } from 'vitest';
-vi.mock('../src/renderer', () => ({
+vi.mock('../src/render/renderer', () => ({
Renderer: {
init: vi.fn(),
resize: vi.fn(),
@@ -43,7 +43,7 @@ vi.mock('../src/postprocess', () => ({
},
}));
-vi.mock('../src/draw', () => ({
+vi.mock('../src/render/draw', () => ({
Draw: {
begin: vi.fn(),
end: vi.fn(),
@@ -52,18 +52,18 @@ vi.mock('../src/draw', () => ({
const mockCallbacks = new Map<string, { fn: (elapsed: number) => void; scene: string }>();
const mockPreSceneCallbacks = new Map<string, (info: unknown) => void>();
-vi.mock('../src/customDraw', () => ({
+vi.mock('../src/render/customDraw', () => ({
getDrawCallbacks: vi.fn(() => mockCallbacks),
unregisterDrawCallback: vi.fn(),
getPreSceneDrawCallbacks: vi.fn(() => mockPreSceneCallbacks),
unregisterPreSceneDrawCallback: vi.fn(),
}));
-import { RenderPipeline } from '../src/renderPipeline';
-import { Renderer } from '../src/renderer';
+import { RenderPipeline } from '../src/render/renderPipeline';
+import { Renderer } from '../src/render/renderer';
import { PostProcess } from '../src/postprocess';
-import { Draw } from '../src/draw';
-import { unregisterDrawCallback } from '../src/customDraw';
+import { Draw } from '../src/render/draw';
+import { unregisterDrawCallback } from '../src/render/customDraw';
describe('RenderPipeline', () => {
let pipeline: RenderPipeline;
diff --git a/sdk/tests/renderTexture.test.ts b/sdk/tests/renderTexture.test.ts
index 585a5a516..55bd3febd 100644
--- a/sdk/tests/renderTexture.test.ts
+++ b/sdk/tests/renderTexture.test.ts
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
-vi.mock('../src/renderer', () => ({
+vi.mock('../src/render/renderer', () => ({
Renderer: {
createRenderTarget: vi.fn().mockReturnValue(1),
releaseRenderTarget: vi.fn(),
@@ -13,9 +13,9 @@ vi.mock('../src/renderer', () => ({
},
}));
-import { RenderTexture } from '../src/renderTexture';
-import { Renderer } from '../src/renderer';
-import { initResourceManager, shutdownResourceManager } from '../src/resourceManager';
+import { RenderTexture } from '../src/render/renderTexture';
+import { Renderer } from '../src/render/renderer';
+import { initResourceManager, shutdownResourceManager } from '../src/wasm/resourceManager';
import type { CppResourceManager } from '../src/wasm';
describe('RenderTexture', () => {
diff --git a/sdk/tests/renderer.test.ts b/sdk/tests/renderer.test.ts
index bd1497ef3..e847ebeee 100644
--- a/sdk/tests/renderer.test.ts
+++ b/sdk/tests/renderer.test.ts
@@ -6,10 +6,10 @@ import {
RenderStage,
initRendererAPI,
shutdownRendererAPI,
-} from '../src/renderer';
-import type { RenderStats } from '../src/renderer';
+} from '../src/render/renderer';
+import type { RenderStats } from '../src/render/renderer';
import type { ESEngineModule } from '../src/wasm';
-import { initResourceManager, shutdownResourceManager } from '../src/resourceManager';
+import { initResourceManager, shutdownResourceManager } from '../src/wasm/resourceManager';
// =============================================================================
// Mock WASM module for Renderer API
diff --git a/sdk/tests/replicated-fields.test.ts b/sdk/tests/replicated-fields.test.ts
index af622f4bd..6e0045182 100644
--- a/sdk/tests/replicated-fields.test.ts
+++ b/sdk/tests/replicated-fields.test.ts
@@ -11,8 +11,8 @@ import {
defineComponent,
getReplicatedFields,
clearUserComponents,
-} from '../src/component';
-import { COMPONENT_META } from '../src/component.generated';
+} from '../src/ecs/component';
+import { COMPONENT_META } from '../src/ecs/component.generated';
describe('replicated single-source (builtins)', () => {
it('Transform authors its local pose as replicated at the ES_PROPERTY site', () => {
diff --git a/sdk/tests/replication-e2e-ws.test.ts b/sdk/tests/replication-e2e-ws.test.ts
index e727534be..7647c47ac 100644
--- a/sdk/tests/replication-e2e-ws.test.ts
+++ b/sdk/tests/replication-e2e-ws.test.ts
@@ -11,8 +11,8 @@
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import { WebSocketServer, type WebSocket as WsSocket } from 'ws';
import { App } from '../src/app';
-import { createHeadlessApp } from '../src/webAppFactory';
-import { defineComponent, clearUserComponents, Transform } from '../src/component';
+import { createHeadlessApp } from '../src/runtime/webAppFactory';
+import { defineComponent, clearUserComponents, Transform } from '../src/ecs/component';
import type { ESEngineModule } from '../src/wasm';
import { loadWasmModule, HAS_WASM } from './helpers/loadWasm';
import { GameSocket } from '../src/net/GameSocket';
diff --git a/sdk/tests/replication-input.test.ts b/sdk/tests/replication-input.test.ts
index a1fd3ea01..de39e36ef 100644
--- a/sdk/tests/replication-input.test.ts
+++ b/sdk/tests/replication-input.test.ts
@@ -9,8 +9,8 @@
*/
import { describe, it, expect, beforeEach } from 'vitest';
import { App } from '../src/app';
-import { defineComponent, clearUserComponents } from '../src/component';
-import { defineSystem, Schedule, GetWorld } from '../src/system';
+import { defineComponent, clearUserComponents } from '../src/ecs/component';
+import { defineSystem, Schedule, GetWorld } from '../src/ecs/system';
import { MemoryTransport } from '../src/net/MemoryTransport';
import { replicationPlugin, Net, Replicated } from '../src/net/replication';
diff --git a/sdk/tests/replication-interest.test.ts b/sdk/tests/replication-interest.test.ts
index 31b0bf367..40dab6ea4 100644
--- a/sdk/tests/replication-interest.test.ts
+++ b/sdk/tests/replication-interest.test.ts
@@ -9,14 +9,14 @@
*/
import { describe, it, expect, beforeEach } from 'vitest';
import { App } from '../src/app';
-import { defineComponent, clearUserComponents, Name } from '../src/component';
+import { defineComponent, clearUserComponents, Name } from '../src/ecs/component';
import { MemoryTransport } from '../src/net/MemoryTransport';
import {
replicationPlugin, Net, Replicated, radiusInterest,
type InterestPolicy,
} from '../src/net/replication';
import type { Entity } from '../src/types';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
const STEP = 1 / 60;
diff --git a/sdk/tests/replication-interp.test.ts b/sdk/tests/replication-interp.test.ts
index 1e840d604..3809ea34f 100644
--- a/sdk/tests/replication-interp.test.ts
+++ b/sdk/tests/replication-interp.test.ts
@@ -8,7 +8,7 @@
*/
import { describe, it, expect, beforeEach } from 'vitest';
import { App } from '../src/app';
-import { defineComponent, clearUserComponents } from '../src/component';
+import { defineComponent, clearUserComponents } from '../src/ecs/component';
import { MemoryTransport } from '../src/net/MemoryTransport';
import {
replicationPlugin, Net, Replicated,
diff --git a/sdk/tests/replication-prediction.test.ts b/sdk/tests/replication-prediction.test.ts
index 4e6ef95c7..2814fe561 100644
--- a/sdk/tests/replication-prediction.test.ts
+++ b/sdk/tests/replication-prediction.test.ts
@@ -11,12 +11,12 @@
*/
import { describe, it, expect, beforeEach } from 'vitest';
import { App } from '../src/app';
-import { defineComponent, clearUserComponents } from '../src/component';
-import { defineSystem, Schedule, GetWorld } from '../src/system';
+import { defineComponent, clearUserComponents } from '../src/ecs/component';
+import { defineSystem, Schedule, GetWorld } from '../src/ecs/system';
import { MemoryTransport } from '../src/net/MemoryTransport';
import { replicationPlugin, Net, Replicated, type ReplicationServer } from '../src/net/replication';
import type { Entity } from '../src/types';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
const STEP = 1 / 60;
const SPEED = 600; // units/second → 10 units per tick
diff --git a/sdk/tests/replication-wasm.test.ts b/sdk/tests/replication-wasm.test.ts
index 42aa3aecf..e8880566d 100644
--- a/sdk/tests/replication-wasm.test.ts
+++ b/sdk/tests/replication-wasm.test.ts
@@ -8,7 +8,7 @@
*/
import { describe, it, expect, beforeAll } from 'vitest';
import { App } from '../src/app';
-import { Transform, getReplicatedFields } from '../src/component';
+import { Transform, getReplicatedFields } from '../src/ecs/component';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
import { loadWasmModule, HAS_WASM } from './helpers/loadWasm';
import { MemoryTransport } from '../src/net/MemoryTransport';
diff --git a/sdk/tests/replication.test.ts b/sdk/tests/replication.test.ts
index 37725a97a..510faba1c 100644
--- a/sdk/tests/replication.test.ts
+++ b/sdk/tests/replication.test.ts
@@ -10,8 +10,8 @@
*/
import { describe, it, expect, beforeEach } from 'vitest';
import { App } from '../src/app';
-import { defineComponent, clearUserComponents } from '../src/component';
-import { ABI_LAYOUT_HASH } from '../src/component.generated';
+import { defineComponent, clearUserComponents } from '../src/ecs/component';
+import { ABI_LAYOUT_HASH } from '../src/ecs/component.generated';
import { MemoryTransport } from '../src/net/MemoryTransport';
import { NetChannel } from '../src/net/NetChannel';
import {
diff --git a/sdk/tests/resource.test.ts b/sdk/tests/resource.test.ts
index d53f6be0a..75fe20421 100644
--- a/sdk/tests/resource.test.ts
+++ b/sdk/tests/resource.test.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
-import { defineResource, Res, ResMut, ResourceStorage, ResMutInstance } from '../src/resource';
+import { defineResource, Res, ResMut, ResourceStorage, ResMutInstance } from '../src/ecs/resource';
describe('Resource System', () => {
describe('defineResource', () => {
diff --git a/sdk/tests/resourcemanager-bridge.test.ts b/sdk/tests/resourcemanager-bridge.test.ts
index 6756bdc3e..b7382d566 100644
--- a/sdk/tests/resourcemanager-bridge.test.ts
+++ b/sdk/tests/resourcemanager-bridge.test.ts
@@ -7,11 +7,11 @@
* touchpoint after the F2 five-pattern unification.
*/
import { describe, it, expect, vi, afterEach } from 'vitest';
-import { WasmModuleAborted } from '../src/moduleHealth';
+import { WasmModuleAborted } from '../src/wasm/moduleHealth';
import {
initResourceManager, shutdownResourceManager,
requireResourceManager, getResourceManager,
-} from '../src/resourceManager';
+} from '../src/wasm/resourceManager';
import type { CppResourceManager, ESEngineModule } from '../src/wasm';
function makeRm() {
diff --git a/sdk/tests/run-mode.test.ts b/sdk/tests/run-mode.test.ts
index 63966855c..7023d8916 100644
--- a/sdk/tests/run-mode.test.ts
+++ b/sdk/tests/run-mode.test.ts
@@ -11,9 +11,9 @@
*/
import { describe, expect, it, afterEach } from 'vitest';
import { App } from '../src/app';
-import { Schedule, defineSystem } from '../src/system';
+import { Schedule, defineSystem } from '../src/ecs/system';
import { setEditorMode, setPlayMode, isEditor, isPlayMode, isRuntime, playModeOnly } from '../src/env';
-import { getDefaultContext } from '../src/context';
+import { getDefaultContext } from '../src/ecs/context';
function namedSystem(name: string, trace: string[]) {
return defineSystem([], () => { trace.push(name); }, { name });
diff --git a/sdk/tests/runtime-assets-persistence.test.ts b/sdk/tests/runtime-assets-persistence.test.ts
index 11b5db521..1747b0b2b 100644
--- a/sdk/tests/runtime-assets-persistence.test.ts
+++ b/sdk/tests/runtime-assets-persistence.test.ts
@@ -9,11 +9,11 @@
* caches/refcounts on every scene switch.
*/
import { describe, it, expect } from 'vitest';
-import { loadRuntimeScene } from '../src/runtimeLoader';
+import { loadRuntimeScene } from '../src/runtime/runtimeLoader';
import { Assets as AssetsResource } from '../src/asset/AssetPlugin';
import { Assets as AssetsClass } from '../src/asset/Assets';
import { ManifestModel } from '../src/asset/AddressableManifest';
-import { World } from '../src/world';
+import { World } from '../src/ecs/world';
import type { App } from '../src/app';
import type { Backend } from '../src/asset/Backend';
import type { ESEngineModule } from '../src/wasm';
diff --git a/sdk/tests/runtime-only-serialize.test.ts b/sdk/tests/runtime-only-serialize.test.ts
index b98db80ed..610a5256f 100644
--- a/sdk/tests/runtime-only-serialize.test.ts
+++ b/sdk/tests/runtime-only-serialize.test.ts
@@ -8,8 +8,8 @@
* play-stop world restore would double every Tiled layer).
*/
import { describe, it, expect } from 'vitest';
-import { World } from '../src/world';
-import { Transform, RuntimeOnly, Name, Parent } from '../src/component';
+import { World } from '../src/ecs/world';
+import { Transform, RuntimeOnly, Name, Parent } from '../src/ecs/component';
import { serializeScene } from '../src/scene';
import { createMockModule } from './mocks/wasm';
diff --git a/sdk/tests/scene-asset-release.test.ts b/sdk/tests/scene-asset-release.test.ts
index 5f277820c..a73b77d33 100644
--- a/sdk/tests/scene-asset-release.test.ts
+++ b/sdk/tests/scene-asset-release.test.ts
@@ -11,7 +11,7 @@ import { describe, expect, it, beforeEach, vi } from 'vitest';
vi.mock('../src/scene', () => ({
loadSceneWithAssets: vi.fn().mockResolvedValue(new Map()),
}));
-vi.mock('../src/customDraw', () => ({
+vi.mock('../src/render/customDraw', () => ({
registerDrawCallback: vi.fn(),
unregisterDrawCallback: vi.fn(),
}));
@@ -19,14 +19,14 @@ vi.mock('../src/postprocess', () => ({
PostProcess: { bind: vi.fn(), unbind: vi.fn() },
PostProcessStack: vi.fn(),
}));
-vi.mock('../src/material', () => ({
+vi.mock('../src/render/material', () => ({
Material: { release: vi.fn(), createShader: vi.fn() },
defineResource: vi.fn(),
}));
import { SceneManagerState } from '../src/sceneManager';
import { Assets } from '../src/asset';
-import { Material } from '../src/material';
+import { Material } from '../src/render/material';
function createMockApp(assets?: unknown) {
const entities = new Map<number, Map<symbol, unknown>>();
diff --git a/sdk/tests/scene-load-failure.test.ts b/sdk/tests/scene-load-failure.test.ts
index 1d44b997e..7c3e44d02 100644
--- a/sdk/tests/scene-load-failure.test.ts
+++ b/sdk/tests/scene-load-failure.test.ts
@@ -14,7 +14,7 @@ import { describe, expect, it, beforeEach, vi } from 'vitest';
vi.mock('../src/scene', () => ({
loadSceneWithAssets: vi.fn().mockResolvedValue(new Map()),
}));
-vi.mock('../src/customDraw', () => ({
+vi.mock('../src/render/customDraw', () => ({
registerDrawCallback: vi.fn(),
unregisterDrawCallback: vi.fn(),
}));
@@ -22,7 +22,7 @@ vi.mock('../src/postprocess', () => ({
PostProcess: { bind: vi.fn(), unbind: vi.fn() },
PostProcessStack: vi.fn(),
}));
-vi.mock('../src/material', () => ({
+vi.mock('../src/render/material', () => ({
Material: { release: vi.fn(), createShader: vi.fn() },
defineResource: vi.fn(),
}));
diff --git a/sdk/tests/scene-load-progress-forward.test.ts b/sdk/tests/scene-load-progress-forward.test.ts
index 4d237fb9a..84757d281 100644
--- a/sdk/tests/scene-load-progress-forward.test.ts
+++ b/sdk/tests/scene-load-progress-forward.test.ts
@@ -13,9 +13,9 @@ vi.mock('../src/scene', () => ({
return Promise.resolve(new Map());
}),
}));
-vi.mock('../src/customDraw', () => ({ registerDrawCallback: vi.fn(), unregisterDrawCallback: vi.fn() }));
+vi.mock('../src/render/customDraw', () => ({ registerDrawCallback: vi.fn(), unregisterDrawCallback: vi.fn() }));
vi.mock('../src/postprocess', () => ({ PostProcess: { bind: vi.fn(), unbind: vi.fn() }, PostProcessStack: vi.fn() }));
-vi.mock('../src/material', () => ({ Material: { release: vi.fn(), createShader: vi.fn() }, defineResource: vi.fn() }));
+vi.mock('../src/render/material', () => ({ Material: { release: vi.fn(), createShader: vi.fn() }, defineResource: vi.fn() }));
import { SceneManagerState } from '../src/sceneManager';
diff --git a/sdk/tests/scene-loading-progress.test.ts b/sdk/tests/scene-loading-progress.test.ts
index a358c3529..384575166 100644
--- a/sdk/tests/scene-loading-progress.test.ts
+++ b/sdk/tests/scene-loading-progress.test.ts
@@ -6,7 +6,7 @@ import { Catalog } from '../src/asset/Catalog';
import type { Backend } from '../src/asset/Backend';
import type { SceneData } from '../src/scene';
-vi.mock('../src/resourceManager', () => ({
+vi.mock('../src/wasm/resourceManager', () => ({
requireResourceManager: () => ({
createTexture: vi.fn(() => 1),
registerExternalTexture: vi.fn(() => 1),
diff --git a/sdk/tests/scene-prefab.test.ts b/sdk/tests/scene-prefab.test.ts
index 60791f264..e2a5a5ee2 100644
--- a/sdk/tests/scene-prefab.test.ts
+++ b/sdk/tests/scene-prefab.test.ts
@@ -13,9 +13,9 @@
* - `loadSceneWithAssets` actually spawning the expanded instance into a World.
*/
import { describe, it, expect, vi } from 'vitest';
-import { World } from '../src/world';
+import { World } from '../src/ecs/world';
import { createMockModule } from './mocks/wasm';
-import { defineBuiltin, defineComponent } from '../src/component';
+import { defineBuiltin, defineComponent } from '../src/ecs/component';
import { INVALID_ENTITY } from '../src/types';
import {
loadSceneData,
diff --git a/sdk/tests/scene-transition-controller.test.ts b/sdk/tests/scene-transition-controller.test.ts
index 4fa20809a..431820982 100644
--- a/sdk/tests/scene-transition-controller.test.ts
+++ b/sdk/tests/scene-transition-controller.test.ts
@@ -12,12 +12,12 @@ const drawCalls = {
unregister: vi.fn(),
};
-vi.mock('../src/customDraw', () => ({
+vi.mock('../src/render/customDraw', () => ({
registerDrawCallback: (id: string, fn: () => void) => drawCalls.register(id, fn),
unregisterDrawCallback: (id: string) => drawCalls.unregister(id),
}));
-vi.mock('../src/draw', () => ({
+vi.mock('../src/render/draw', () => ({
Draw: {
setLayer: vi.fn(),
setDepth: vi.fn(),
diff --git a/sdk/tests/scene-transition-errors.test.ts b/sdk/tests/scene-transition-errors.test.ts
index db991f2a0..fdeed3835 100644
--- a/sdk/tests/scene-transition-errors.test.ts
+++ b/sdk/tests/scene-transition-errors.test.ts
@@ -10,7 +10,7 @@ import { describe, expect, it, beforeEach, vi } from 'vitest';
vi.mock('../src/scene', () => ({
loadSceneWithAssets: vi.fn().mockResolvedValue(new Map()),
}));
-vi.mock('../src/customDraw', () => ({
+vi.mock('../src/render/customDraw', () => ({
registerDrawCallback: vi.fn(),
unregisterDrawCallback: vi.fn(),
}));
@@ -18,7 +18,7 @@ vi.mock('../src/postprocess', () => ({
PostProcess: { bind: vi.fn(), unbind: vi.fn() },
PostProcessStack: vi.fn(),
}));
-vi.mock('../src/material', () => ({
+vi.mock('../src/render/material', () => ({
Material: { release: vi.fn(), createShader: vi.fn() },
defineResource: vi.fn(),
}));
diff --git a/sdk/tests/scene-uses-physics.test.ts b/sdk/tests/scene-uses-physics.test.ts
index 6c1a9748c..faaa7c367 100644
--- a/sdk/tests/scene-uses-physics.test.ts
+++ b/sdk/tests/scene-uses-physics.test.ts
@@ -8,7 +8,7 @@
* so the ref check is what keeps tilemap-only-collision scenes working.
*/
import { describe, it, expect } from 'vitest';
-import { sceneUsesPhysics } from '../src/runtimeLoader';
+import { sceneUsesPhysics } from '../src/runtime/runtimeLoader';
import type { SceneData } from '../src/scene';
function scene(components: Array<{ type: string; data?: Record<string, unknown> }>): SceneData {
diff --git a/sdk/tests/scene.test.ts b/sdk/tests/scene.test.ts
index 57a145055..0b5d06811 100644
--- a/sdk/tests/scene.test.ts
+++ b/sdk/tests/scene.test.ts
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, vi, beforeEach } from 'vitest';
-import { World } from '../src/world';
+import { World } from '../src/ecs/world';
import { createMockModule } from './mocks/wasm';
-import { defineComponent, defineBuiltin, Name, Camera } from '../src/component';
+import { defineComponent, defineBuiltin, Name, Camera } from '../src/ecs/component';
import { INVALID_ENTITY } from '../src/types';
import {
loadSceneData,
@@ -25,7 +25,7 @@ import {
} from '../src/scene';
import type { Entity } from '../src/types';
import { discoverSceneAssets } from '../src/asset/discoverAssets';
-import { initResourceManager, shutdownResourceManager } from '../src/resourceManager';
+import { initResourceManager, shutdownResourceManager } from '../src/wasm/resourceManager';
const Transform = defineBuiltin('Transform', {
position: { x: 0, y: 0, z: 0 },
diff --git a/sdk/tests/sceneManager.test.ts b/sdk/tests/sceneManager.test.ts
index c8c82c817..a9b7bb396 100644
--- a/sdk/tests/sceneManager.test.ts
+++ b/sdk/tests/sceneManager.test.ts
@@ -6,7 +6,7 @@ vi.mock('../src/scene', () => ({
loadSceneWithAssets: vi.fn().mockResolvedValue(new Map()),
}));
-vi.mock('../src/customDraw', () => ({
+vi.mock('../src/render/customDraw', () => ({
registerDrawCallback: vi.fn(),
unregisterDrawCallback: vi.fn(),
}));
@@ -19,7 +19,7 @@ vi.mock('../src/postprocess', () => ({
PostProcessStack: vi.fn(),
}));
-vi.mock('../src/material', () => ({
+vi.mock('../src/render/material', () => ({
Material: {
release: vi.fn(),
createShader: vi.fn(),
@@ -27,7 +27,7 @@ vi.mock('../src/material', () => ({
defineResource: vi.fn(),
}));
-vi.mock('../src/draw', () => ({
+vi.mock('../src/render/draw', () => ({
Draw: {
setLayer: vi.fn(),
setDepth: vi.fn(),
@@ -35,7 +35,7 @@ vi.mock('../src/draw', () => ({
},
}));
-vi.mock('../src/resource', () => ({
+vi.mock('../src/ecs/resource', () => ({
defineResource: vi.fn((_init: unknown, name?: string) => ({
_id: Symbol(name ?? 'Resource'),
_name: name ?? 'Resource',
@@ -43,7 +43,7 @@ vi.mock('../src/resource', () => ({
})),
}));
-vi.mock('../src/component', () => ({
+vi.mock('../src/ecs/component', () => ({
SceneOwner: Symbol('SceneOwner'),
Disabled: { _id: Symbol('Disabled'), _name: 'Disabled', _builtin: false, _default: {} },
Sprite: Symbol('Sprite'),
@@ -67,11 +67,11 @@ vi.mock('../src/defaults', () => ({
}));
import { SceneManagerState, SceneLoadCancelled, wrapSceneSystem } from '../src/sceneManager';
-import { SceneOwner, Sprite, SpineAnimation, BitmapText } from '../src/component';
+import { SceneOwner, Sprite, SpineAnimation, BitmapText } from '../src/ecs/component';
import { loadSceneWithAssets } from '../src/scene';
-import { registerDrawCallback, unregisterDrawCallback } from '../src/customDraw';
+import { registerDrawCallback, unregisterDrawCallback } from '../src/render/customDraw';
import { PostProcess } from '../src/postprocess';
-import { Material } from '../src/material';
+import { Material } from '../src/render/material';
function createMockApp() {
const entities = new Map<number, Map<symbol, any>>();
diff --git a/sdk/tests/scheduler-cycles.test.ts b/sdk/tests/scheduler-cycles.test.ts
index 9c854b1e1..498a1d95e 100644
--- a/sdk/tests/scheduler-cycles.test.ts
+++ b/sdk/tests/scheduler-cycles.test.ts
@@ -6,7 +6,7 @@
*/
import { describe, expect, it } from 'vitest';
import { App } from '../src/app';
-import { Schedule, defineSystem } from '../src/system';
+import { Schedule, defineSystem } from '../src/ecs/system';
function trackedSystem(name: string, trace: string[]) {
return defineSystem([], () => { trace.push(name); }, { name });
diff --git a/sdk/tests/setup.ts b/sdk/tests/setup.ts
index dae2281de..2bf446298 100644
--- a/sdk/tests/setup.ts
+++ b/sdk/tests/setup.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { beforeEach } from 'vitest';
-import { clearUserComponents } from '../src/component';
+import { clearUserComponents } from '../src/ecs/component';
beforeEach(() => {
clearUserComponents();
diff --git a/sdk/tests/shader-twins.test.ts b/sdk/tests/shader-twins.test.ts
index 8460f271c..b7e18fce9 100644
--- a/sdk/tests/shader-twins.test.ts
+++ b/sdk/tests/shader-twins.test.ts
@@ -8,7 +8,7 @@
// WebGPU backend.
import { describe, expect, it } from 'vitest';
-import { BUILTIN_SHADER_TEMPLATES } from '../src/builtinShaders';
+import { BUILTIN_SHADER_TEMPLATES } from '../src/render/builtinShaders';
// The filter modules export functions, not their sources — read the sources
// from disk so the guard sees exactly what ships.
@@ -41,8 +41,8 @@ function sectionsBalance(source: string): boolean {
const CASES: Array<{ name: string; source: string }> = [
...BUILTIN_SHADER_TEMPLATES.map((t) => ({ name: `template:${t.id}`, source: t.source })),
- ...embeddedEsshaders('filters.ts').map((source, i) => ({ name: `filters.ts[${i}]`, source })),
- ...embeddedEsshaders('spriteFilter.ts').map((source, i) => ({ name: `spriteFilter.ts[${i}]`, source })),
+ ...embeddedEsshaders('render/filters.ts').map((source, i) => ({ name: `filters.ts[${i}]`, source })),
+ ...embeddedEsshaders('render/spriteFilter.ts').map((source, i) => ({ name: `spriteFilter.ts[${i}]`, source })),
...embeddedEsshaders('postprocess/postProcessEffects.ts').map(
(source, i) => ({ name: `postProcessEffects.ts[${i}]`, source })),
...embeddedEsshaders('camera/editorGridRenderer.ts').map(
diff --git a/sdk/tests/spine-apply-routing.test.ts b/sdk/tests/spine-apply-routing.test.ts
index b92a2abac..3c1c7a380 100644
--- a/sdk/tests/spine-apply-routing.test.ts
+++ b/sdk/tests/spine-apply-routing.test.ts
@@ -8,7 +8,7 @@
* remnant that left 4.2 spine unrendered in the runtime/play path.
*/
import { describe, it, expect, beforeEach, vi } from 'vitest';
-import { defineComponent, clearUserComponents } from '../src/component';
+import { defineComponent, clearUserComponents } from '../src/ecs/component';
import { applySpineEntities, spineEntityProps } from '../src/spine/loadSpineScene';
import type { SceneData } from '../src/scene';
import type { Entity } from '../src/types';
diff --git a/sdk/tests/spine-atlas-page-resolve.test.ts b/sdk/tests/spine-atlas-page-resolve.test.ts
index b561ad05e..2895e752e 100644
--- a/sdk/tests/spine-atlas-page-resolve.test.ts
+++ b/sdk/tests/spine-atlas-page-resolve.test.ts
@@ -18,13 +18,13 @@ const { rm, createTextureFromPixels } = vi.hoisted(() => ({
},
createTextureFromPixels: vi.fn(() => 11),
}));
-vi.mock('../src/resourceManager', () => ({
+vi.mock('../src/wasm/resourceManager', () => ({
requireResourceManager: () => rm,
}));
-vi.mock('../src/runtimeAssets', () => ({ createTextureFromPixels }));
+vi.mock('../src/runtime/runtimeAssets', () => ({ createTextureFromPixels }));
import { loadSpineAssets } from '../src/spine/loadSpineScene';
-import type { RuntimeAssetSource } from '../src/runtimeAssets';
+import type { RuntimeAssetSource } from '../src/runtime/runtimeAssets';
import type { BasisTranscoder } from '../src/asset/compressed';
const ATLAS = 'spineboy.png\nsize: 4,4\nformat: RGBA8888\n';
diff --git a/sdk/tests/spine-bridge.test.ts b/sdk/tests/spine-bridge.test.ts
index 621cef2d2..bca0441e8 100644
--- a/sdk/tests/spine-bridge.test.ts
+++ b/sdk/tests/spine-bridge.test.ts
@@ -8,7 +8,7 @@
* now fully side-module.
*/
import { describe, it, expect, vi } from 'vitest';
-import { WasmModuleAborted } from '../src/moduleHealth';
+import { WasmModuleAborted } from '../src/wasm/moduleHealth';
import { SpineModuleController } from '../src/spine/SpineController';
import type { SpineWasmModule, SpineWrappedAPI } from '../src/spine/SpineModuleLoader';
diff --git a/sdk/tests/sprite-animator.test.ts b/sdk/tests/sprite-animator.test.ts
index 9933669c7..214eae643 100644
--- a/sdk/tests/sprite-animator.test.ts
+++ b/sdk/tests/sprite-animator.test.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
-import { World } from '../src/world';
-import { Sprite, type SpriteData } from '../src/component';
+import { World } from '../src/ecs/world';
+import { Sprite, type SpriteData } from '../src/ecs/component';
import type { CppRegistry, ESEngineModule } from '../src/wasm';
import type { Entity } from '../src/types';
import {
diff --git a/sdk/tests/sprite-filter.test.ts b/sdk/tests/sprite-filter.test.ts
index 0ee2ded08..ce1925f27 100644
--- a/sdk/tests/sprite-filter.test.ts
+++ b/sdk/tests/sprite-filter.test.ts
@@ -16,7 +16,7 @@ const materialCalls: Array<
let nextShaderId = 100;
let nextMaterialId = 1000;
-vi.mock('../src/material', () => {
+vi.mock('../src/render/material', () => {
return {
Material: {
compileShader: vi.fn(() => {
@@ -34,7 +34,7 @@ vi.mock('../src/material', () => {
};
});
-import { SpriteFilter } from '../src/spriteFilter';
+import { SpriteFilter } from '../src/render/spriteFilter';
beforeEach(() => {
materialCalls.length = 0;
diff --git a/sdk/tests/stats.test.ts b/sdk/tests/stats.test.ts
index 3aadb3702..ae5942b9f 100644
--- a/sdk/tests/stats.test.ts
+++ b/sdk/tests/stats.test.ts
@@ -4,10 +4,10 @@ import { describe, it, expect, vi, afterEach } from 'vitest';
import { StatsCollector, defaultFrameStats, Stats, StatsPlugin, statsPlugin, FrameHistory, type FrameStats } from '../src/stats';
import { StatsOverlay } from '../src/stats-overlay';
import { App } from '../src/app';
-import { Schedule, defineSystem, SystemRunner } from '../src/system';
-import { World } from '../src/world';
-import { ResourceStorage } from '../src/resource';
-import * as rendererModule from '../src/renderer';
+import { Schedule, defineSystem, SystemRunner } from '../src/ecs/system';
+import { World } from '../src/ecs/world';
+import { ResourceStorage } from '../src/ecs/resource';
+import * as rendererModule from '../src/render/renderer';
afterEach(() => {
vi.restoreAllMocks();
diff --git a/sdk/tests/subsystems.test.ts b/sdk/tests/subsystems.test.ts
index 9570ccc30..7b15d9fcd 100644
--- a/sdk/tests/subsystems.test.ts
+++ b/sdk/tests/subsystems.test.ts
@@ -3,7 +3,7 @@
import { describe, it, expect, vi } from 'vitest';
import { SubsystemRegistry } from '../src/subsystems';
import { App, type Plugin } from '../src/app';
-import { Schedule, defineSystem } from '../src/system';
+import { Schedule, defineSystem } from '../src/ecs/system';
describe('SubsystemRegistry', () => {
it('registers in the registered phase, in install order, inactive', () => {
diff --git a/sdk/tests/system-ordering.test.ts b/sdk/tests/system-ordering.test.ts
index 288a5ea76..98b5322aa 100644
--- a/sdk/tests/system-ordering.test.ts
+++ b/sdk/tests/system-ordering.test.ts
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
import { App } from '../src/app';
-import { defineSystem, Schedule } from '../src/system';
+import { defineSystem, Schedule } from '../src/ecs/system';
describe('System Dependency Ordering', () => {
let app: App;
diff --git a/sdk/tests/system-set.test.ts b/sdk/tests/system-set.test.ts
index 214e46b51..f08417aa9 100644
--- a/sdk/tests/system-set.test.ts
+++ b/sdk/tests/system-set.test.ts
@@ -6,7 +6,7 @@
*/
import { describe, expect, it } from 'vitest';
import { App } from '../src/app';
-import { Schedule, defineSystem, defineSystemSet } from '../src/system';
+import { Schedule, defineSystem, defineSystemSet } from '../src/ecs/system';
function namedSystem(name: string, trace: string[]) {
return defineSystem([], () => { trace.push(name); }, { name });
diff --git a/sdk/tests/system.test.ts b/sdk/tests/system.test.ts
index 196906e28..8bc4ec446 100644
--- a/sdk/tests/system.test.ts
+++ b/sdk/tests/system.test.ts
@@ -9,14 +9,14 @@ import {
addStartupSystem,
addSystemToSchedule,
SystemRunner,
-} from '../src/system';
-import { getDefaultContext } from '../src/context';
-import { Query, Mut, Added, Changed, QueryInstance, Removed, RemovedQueryInstance } from '../src/query';
-import { Res, ResMut, ResMutInstance, defineResource, ResourceStorage } from '../src/resource';
-import { Commands, CommandsInstance } from '../src/commands';
-import { EventWriter, EventReader, EventWriterInstance, EventReaderInstance, defineEvent, EventRegistry } from '../src/event';
-import { defineComponent } from '../src/component';
-import type { World } from '../src/world';
+} from '../src/ecs/system';
+import { getDefaultContext } from '../src/ecs/context';
+import { Query, Mut, Added, Changed, QueryInstance, Removed, RemovedQueryInstance } from '../src/ecs/query';
+import { Res, ResMut, ResMutInstance, defineResource, ResourceStorage } from '../src/ecs/resource';
+import { Commands, CommandsInstance } from '../src/ecs/commands';
+import { EventWriter, EventReader, EventWriterInstance, EventReaderInstance, defineEvent, EventRegistry } from '../src/ecs/event';
+import { defineComponent } from '../src/ecs/component';
+import type { World } from '../src/ecs/world';
import type { Entity } from '../src/types';
// =============================================================================
diff --git a/sdk/tests/texture-budget.test.ts b/sdk/tests/texture-budget.test.ts
index 864dea0dc..a7a268d59 100644
--- a/sdk/tests/texture-budget.test.ts
+++ b/sdk/tests/texture-budget.test.ts
@@ -5,7 +5,7 @@ import {
initResourceManager,
shutdownResourceManager,
setTextureBudget,
-} from '../src/resourceManager';
+} from '../src/wasm/resourceManager';
const setBudget = vi.fn();
const mockRm = {
diff --git a/sdk/tests/texture-params.test.ts b/sdk/tests/texture-params.test.ts
index 9022d9ceb..3ddc93bd6 100644
--- a/sdk/tests/texture-params.test.ts
+++ b/sdk/tests/texture-params.test.ts
@@ -15,7 +15,7 @@ const rendererCalls: Array<{
wrapT: number;
}> = [];
-vi.mock('../src/renderer', () => ({
+vi.mock('../src/render/renderer', () => ({
Renderer: {
setTextureParams: vi.fn((
textureId: number,
@@ -35,7 +35,7 @@ import {
setTextureFilter,
setTextureWrap,
setTextureParams,
-} from '../src/textureParams';
+} from '../src/render/textureParams';
describe('textureParams enums', () => {
it('maps Nearest/Linear to 0/1', () => {
diff --git a/sdk/tests/texture-residency.test.ts b/sdk/tests/texture-residency.test.ts
index 7dbbb58cd..a8912d5d9 100644
--- a/sdk/tests/texture-residency.test.ts
+++ b/sdk/tests/texture-residency.test.ts
@@ -94,7 +94,7 @@ function createPoolFake() {
let pool = createPoolFake();
-vi.mock('../src/resourceManager', () => ({
+vi.mock('../src/wasm/resourceManager', () => ({
requireResourceManager: () => pool,
getResourceManager: () => pool,
evictTextureDimensions: vi.fn(),
diff --git a/sdk/tests/tiled-tile-collision.test.ts b/sdk/tests/tiled-tile-collision.test.ts
index 9653a13f8..4526200aa 100644
--- a/sdk/tests/tiled-tile-collision.test.ts
+++ b/sdk/tests/tiled-tile-collision.test.ts
@@ -7,7 +7,7 @@
*/
import { describe, it, expect, vi } from 'vitest';
import { parseTmjJson, tiledObjectgroupShape, tiledCollisionMods, generateLayerTileShapes } from '../src/tilemap/tiledLoader';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
import type { Entity } from '../src/types';
function mockWorld() {
diff --git a/sdk/tests/tilemap-polygon-collision.test.ts b/sdk/tests/tilemap-polygon-collision.test.ts
index 06595781f..38f687663 100644
--- a/sdk/tests/tilemap-polygon-collision.test.ts
+++ b/sdk/tests/tilemap-polygon-collision.test.ts
@@ -6,7 +6,7 @@ import { resolveTilesetModel, type ResolvedTileCollision } from '../src/tilemap/
import { parseTileset } from '../src/tilemap/tilesetAsset';
import { encodeTile } from '../src/tilemap/tileBits';
import { CHUNK_SIZE } from '../src/tilemap/chunkCodec';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
import type { Entity } from '../src/types';
function mockWorld() {
diff --git a/sdk/tests/tilemap.test.ts b/sdk/tests/tilemap.test.ts
index 3dbd83d02..ad4b3da52 100644
--- a/sdk/tests/tilemap.test.ts
+++ b/sdk/tests/tilemap.test.ts
@@ -26,8 +26,8 @@ import { mergeCollisionTiles } from '../src/tilemap/collisionMerge';
import { TilemapAssetLoader } from '../src/asset/loaders/TilemapAssetLoader';
import type { LoadContext } from '../src/asset/AssetLoader';
import { BodyType, RigidBody, BoxCollider, CircleCollider, PolygonCollider, ChainCollider } from '../src/physics/PhysicsComponents';
-import { clearUserComponents, Transform, Marker } from '../src/component';
-import type { World } from '../src/world';
+import { clearUserComponents, Transform, Marker } from '../src/ecs/component';
+import type { World } from '../src/ecs/world';
import type { Entity } from '../src/types';
describe('Tilemap Components', () => {
diff --git a/sdk/tests/timeline-tilemap-ui-bridge.test.ts b/sdk/tests/timeline-tilemap-ui-bridge.test.ts
index 0013dd3ca..a13b4dd4c 100644
--- a/sdk/tests/timeline-tilemap-ui-bridge.test.ts
+++ b/sdk/tests/timeline-tilemap-ui-bridge.test.ts
@@ -8,8 +8,8 @@
* five historical bridge patterns are unified behind WasmBridge.
*/
import { describe, it, expect, vi, afterEach } from 'vitest';
-import { WasmModuleAborted } from '../src/moduleHealth';
-import { CoreApiBridge } from '../src/CoreApiBridge';
+import { WasmModuleAborted } from '../src/wasm/moduleHealth';
+import { CoreApiBridge } from '../src/wasm/CoreApiBridge';
import { TilemapAPI, initTilemapAPI, shutdownTilemapAPI } from '../src/tilemap/tilemapAPI';
import { initUIHelpers, getUINodeWidth } from '../src/ui/util/helpers';
import { TimelineAPI } from '../src/timeline/TimelineControl';
diff --git a/sdk/tests/timeline-wasm-integration.test.ts b/sdk/tests/timeline-wasm-integration.test.ts
index 7064da6c0..196399b46 100644
--- a/sdk/tests/timeline-wasm-integration.test.ts
+++ b/sdk/tests/timeline-wasm-integration.test.ts
@@ -7,8 +7,8 @@
* Run `node build-tools/cli.js build -t web` first if missing.
*/
import { describe, it, expect, beforeAll } from 'vitest';
-import { World } from '../src/world';
-import { Transform, Children, Name, getComponent } from '../src/component';
+import { World } from '../src/ecs/world';
+import { Transform, Children, Name, getComponent } from '../src/ecs/component';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
import { loadWasmModule, HAS_WASM } from './helpers/loadWasm';
import {
diff --git a/sdk/tests/transaction.test.ts b/sdk/tests/transaction.test.ts
index a6b5f7f87..7d490d3f3 100644
--- a/sdk/tests/transaction.test.ts
+++ b/sdk/tests/transaction.test.ts
@@ -9,7 +9,7 @@
* it.
*/
import { describe, it, expect, vi, beforeEach } from 'vitest';
-import { Transaction, TransactionManager } from '../src/transaction';
+import { Transaction, TransactionManager } from '../src/ecs/transaction';
import { log } from '../src/logger';
/** A recording op: pushes a marker on forward/reverse so ordering is observable. */
diff --git a/sdk/tests/ui-anchor-preset.test.ts b/sdk/tests/ui-anchor-preset.test.ts
index 9a3b9b544..837415569 100644
--- a/sdk/tests/ui-anchor-preset.test.ts
+++ b/sdk/tests/ui-anchor-preset.test.ts
@@ -19,7 +19,7 @@ import {
import { UIPositionType, UINode, type UINodeData } from '../src/ui/core/ui-node';
import { DimensionUnit, px, auto } from '../src/ui/core/dimension';
import { App } from '../src/app';
-import { Canvas, Transform, Sprite } from '../src/component';
+import { Canvas, Transform, Sprite } from '../src/ecs/component';
import { UICameraInfo } from '../src/ui/core/ui-camera-info';
import { uiLayoutPlugin } from '../src/ui/layout/layout';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
diff --git a/sdk/tests/ui-binding.test.ts b/sdk/tests/ui-binding.test.ts
index 44fac2ea7..0c1e09ffd 100644
--- a/sdk/tests/ui-binding.test.ts
+++ b/sdk/tests/ui-binding.test.ts
@@ -7,7 +7,7 @@
import { describe, it, expect } from 'vitest';
import { signal, derived, bind, Text } from '../src/ui';
import type { Entity } from '../src/types';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
function mockWorld() {
const comps = new Map<number, Map<object, unknown>>();
diff --git a/sdk/tests/ui-components.test.ts b/sdk/tests/ui-components.test.ts
index 18543509d..d83cec3bc 100644
--- a/sdk/tests/ui-components.test.ts
+++ b/sdk/tests/ui-components.test.ts
@@ -11,7 +11,7 @@
*/
import { describe, it, expect, beforeAll } from 'vitest';
import { App } from '../src/app';
-import { Transform, Sprite, Canvas } from '../src/component';
+import { Transform, Sprite, Canvas } from '../src/ecs/component';
import { UINode, type UINodeData } from '../src/ui/core/ui-node';
import { UIMask, MaskMode } from '../src/ui/core/ui-mask';
import { FlexContainer, FlexDirection, JustifyContent, AlignItems } from '../src/ui/layout/flex';
diff --git a/sdk/tests/ui-controller-bridges.test.ts b/sdk/tests/ui-controller-bridges.test.ts
index c7e942535..407ac9f43 100644
--- a/sdk/tests/ui-controller-bridges.test.ts
+++ b/sdk/tests/ui-controller-bridges.test.ts
@@ -12,7 +12,7 @@ import { ensureControllerAiRegistrations } from '../src/ui/controller/ai-builtin
import { bindControllerPage } from '../src/ui/controller/bind-page';
import { signal } from '../src/ui/binding/signal';
import type { Entity } from '../src/types';
-import type { AnyComponentDef } from '../src/component';
+import type { AnyComponentDef } from '../src/ecs/component';
function makeMockWorld() {
const storage = new Map<AnyComponentDef, Map<Entity, unknown>>();
diff --git a/sdk/tests/ui-controller-gear.test.ts b/sdk/tests/ui-controller-gear.test.ts
index db096de92..2f50201aa 100644
--- a/sdk/tests/ui-controller-gear.test.ts
+++ b/sdk/tests/ui-controller-gear.test.ts
@@ -7,7 +7,7 @@
* normal/hover/pressed/disabled states through the unified layer.
*/
import { describe, expect, it, beforeEach, vi } from 'vitest';
-import { Transform, Parent, type TransformData } from '../src/component';
+import { Transform, Parent, type TransformData } from '../src/ecs/component';
import { UIVisual, UIVisualType, type UIVisualData } from '../src/ui/core/ui-visual';
import { UINode } from '../src/ui/core/ui-node';
import { px } from '../src/ui/core/dimension';
@@ -32,8 +32,8 @@ import {
lerpGearValue,
} from '../src/ui/controller/gear-apply';
import type { Entity } from '../src/types';
-import type { SystemDef } from '../src/system';
-import type { AnyComponentDef } from '../src/component';
+import type { SystemDef } from '../src/ecs/system';
+import type { AnyComponentDef } from '../src/ecs/component';
/** Minimal World backed by per-component Maps (no C++ registry needed). */
function makeMockWorld() {
diff --git a/sdk/tests/ui-dimension-transient.test.ts b/sdk/tests/ui-dimension-transient.test.ts
index 6d8ce152c..3503a8168 100644
--- a/sdk/tests/ui-dimension-transient.test.ts
+++ b/sdk/tests/ui-dimension-transient.test.ts
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
-import { World } from '../src/world';
+import { World } from '../src/ecs/world';
import { createMockModule } from './mocks/wasm';
-import { defineComponent } from '../src/component';
+import { defineComponent } from '../src/ecs/component';
import { serializeScene } from '../src/scene';
import { DimensionUnit, px, percent, auto, isAuto } from '../src/ui/core/dimension';
diff --git a/sdk/tests/ui-drag-plugin.test.ts b/sdk/tests/ui-drag-plugin.test.ts
index 22201e9e5..c98003169 100644
--- a/sdk/tests/ui-drag-plugin.test.ts
+++ b/sdk/tests/ui-drag-plugin.test.ts
@@ -12,8 +12,8 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { flushPendingSystems } from '../src/app';
import type { App } from '../src/app';
-import { Transform } from '../src/component';
-import { Input, InputState } from '../src/input';
+import { Transform } from '../src/ecs/component';
+import { Input, InputState } from '../src/input/input';
import { UIEvents, UIEventQueue } from '../src/ui/core/events';
import { UICameraInfo } from '../src/ui/core/ui-camera-info';
import type { UICameraData } from '../src/ui/core/ui-camera-info';
diff --git a/sdk/tests/ui-focus-plugin.test.ts b/sdk/tests/ui-focus-plugin.test.ts
index f30615a70..a8fc85a24 100644
--- a/sdk/tests/ui-focus-plugin.test.ts
+++ b/sdk/tests/ui-focus-plugin.test.ts
@@ -11,7 +11,7 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { flushPendingSystems } from '../src/app';
import type { App } from '../src/app';
-import { Input, InputState } from '../src/input';
+import { Input, InputState } from '../src/input/input';
import { UIEvents, UIEventQueue } from '../src/ui/core/events';
import { Focusable, FocusManager } from '../src/ui/input/focusable';
import { Interactable, UIInteraction } from '../src/ui/input/interactable';
diff --git a/sdk/tests/ui-layout-integration.test.ts b/sdk/tests/ui-layout-integration.test.ts
index 7783df23e..7b041eb18 100644
--- a/sdk/tests/ui-layout-integration.test.ts
+++ b/sdk/tests/ui-layout-integration.test.ts
@@ -12,11 +12,11 @@ import { describe, it, expect, beforeAll } from 'vitest';
import { App } from '../src/app';
import { UINode, type UINodeData } from '../src/ui/core/ui-node';
import { FlexContainer, type FlexContainerData } from '../src/ui/layout/flex';
-import { Canvas } from '../src/component';
+import { Canvas } from '../src/ecs/component';
import { UICameraInfo } from '../src/ui/core/ui-camera-info';
import { uiLayoutPlugin } from '../src/ui/layout/layout';
import { uiRenderOrderPlugin } from '../src/ui/render/render-order';
-import { Transform, Sprite } from '../src/component';
+import { Transform, Sprite } from '../src/ecs/component';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
import { loadWasmModule, HAS_WASM } from './helpers/loadWasm';
diff --git a/sdk/tests/ui-layout-rect.test.ts b/sdk/tests/ui-layout-rect.test.ts
index b39ee6ab0..4d1247786 100644
--- a/sdk/tests/ui-layout-rect.test.ts
+++ b/sdk/tests/ui-layout-rect.test.ts
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect } from 'vitest';
import { uiLayoutRect, computeEffectiveOrthoSize, EDITOR_VIEW_ENTITY } from '../src/camera/uiLayoutRect';
-import { CanvasScaleMode } from '../src/wasm.generated';
+import { CanvasScaleMode } from '../src/wasm/wasm.generated';
// A 1280x720 canvas (design aspect 16:9), Expand scale mode.
const canvas = {
diff --git a/sdk/tests/ui-list-view-widget.test.ts b/sdk/tests/ui-list-view-widget.test.ts
index c618c2b3c..4cc0ef989 100644
--- a/sdk/tests/ui-list-view-widget.test.ts
+++ b/sdk/tests/ui-list-view-widget.test.ts
@@ -49,7 +49,7 @@ describe.skipIf(!HAS_WASM)('createListView (WASM integration)', () => {
arrayDataSource(Array.from({ length: n }, (_, i) => i));
const numberRow = {
- create: (w: import('../src/world').World, parent: import('../src/types').Entity) =>
+ create: (w: import('../src/ecs/world').World, parent: import('../src/types').Entity) =>
spawnUIEntity({ world: w, parent, node: { height: px(40) } }),
bind: () => {},
};
diff --git a/sdk/tests/ui-list-view.test.ts b/sdk/tests/ui-list-view.test.ts
index f289c4933..230df4114 100644
--- a/sdk/tests/ui-list-view.test.ts
+++ b/sdk/tests/ui-list-view.test.ts
@@ -8,7 +8,7 @@ import {
type DataSource,
} from '../src/ui';
import type { Entity } from '../src/types';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
// ---- Minimal World stub: enough surface for ListView + ViewPool ----
diff --git a/sdk/tests/ui-node.test.ts b/sdk/tests/ui-node.test.ts
index 5cc3fb631..87c8e6939 100644
--- a/sdk/tests/ui-node.test.ts
+++ b/sdk/tests/ui-node.test.ts
@@ -3,8 +3,8 @@
import { describe, it, expect } from 'vitest';
import { UINode } from '../src/ui/core/ui-node';
import { DimensionUnit } from '../src/ui/core/dimension';
-import { getComponent } from '../src/component';
-import { COMPONENT_META } from '../src/component.generated';
+import { getComponent } from '../src/ecs/component';
+import { COMPONENT_META } from '../src/ecs/component.generated';
describe('UINode (REARCH_GUI F3)', () => {
it('is a registered, non-transient builtin', () => {
diff --git a/sdk/tests/ui-plugin-cleanup.test.ts b/sdk/tests/ui-plugin-cleanup.test.ts
index eebcd11fd..b190361ef 100644
--- a/sdk/tests/ui-plugin-cleanup.test.ts
+++ b/sdk/tests/ui-plugin-cleanup.test.ts
@@ -10,7 +10,7 @@ import { App } from '../src/app';
import { uiPlugin } from '../src/ui/ui-plugin';
import { safeAreaPlugin } from '../src/ui/layout/safe-area';
import { textInputPlugin, TextInputPlugin } from '../src/ui/text/text-input-plugin';
-import { AppContext, setDefaultContext } from '../src/context';
+import { AppContext, setDefaultContext } from '../src/ecs/context';
import { setEditorMode, setPlayMode } from '../src/env';
import { createMockModule } from './mocks/wasm';
import { setPlatform } from '../src/platform/base';
diff --git a/sdk/tests/ui-scrollbar.test.ts b/sdk/tests/ui-scrollbar.test.ts
index 83b824a23..3de719b1b 100644
--- a/sdk/tests/ui-scrollbar.test.ts
+++ b/sdk/tests/ui-scrollbar.test.ts
@@ -10,7 +10,7 @@ import { ScrollContainer, ScrollContainerRegistry } from '../src/ui/collection/s
import { UINode } from '../src/ui/core/ui-node';
import { UIVisual } from '../src/ui/core/ui-visual';
import type { Entity } from '../src/types';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
interface MockWorld {
_entities: Set<number>;
diff --git a/sdk/tests/ui-slider-dropdown.test.ts b/sdk/tests/ui-slider-dropdown.test.ts
index fa5725c61..87e86663b 100644
--- a/sdk/tests/ui-slider-dropdown.test.ts
+++ b/sdk/tests/ui-slider-dropdown.test.ts
@@ -17,7 +17,7 @@ import {
Text,
} from '../src/ui';
import type { Entity } from '../src/types';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
interface MockWorld {
_entities: Set<number>;
diff --git a/sdk/tests/ui-theme-swap.test.ts b/sdk/tests/ui-theme-swap.test.ts
index bf73958df..0d2e97bd6 100644
--- a/sdk/tests/ui-theme-swap.test.ts
+++ b/sdk/tests/ui-theme-swap.test.ts
@@ -23,7 +23,7 @@ import {
type GearValue,
} from '../src/ui';
import type { Entity } from '../src/types';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
// A generic mock world: stores any component def per entity + supports the
// getEntitiesWithComponents query applyThemeToWorld needs.
diff --git a/sdk/tests/ui-two-way-binding.test.ts b/sdk/tests/ui-two-way-binding.test.ts
index 8d04e4c67..e5a008be2 100644
--- a/sdk/tests/ui-two-way-binding.test.ts
+++ b/sdk/tests/ui-two-way-binding.test.ts
@@ -18,7 +18,7 @@ import {
UIEventType,
} from '../src/ui';
import type { Entity } from '../src/types';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
interface MockWorld {
_entities: Set<number>;
diff --git a/sdk/tests/ui-view-pool.test.ts b/sdk/tests/ui-view-pool.test.ts
index 07ae0cea5..c4c30a47a 100644
--- a/sdk/tests/ui-view-pool.test.ts
+++ b/sdk/tests/ui-view-pool.test.ts
@@ -7,7 +7,7 @@
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { ViewPool } from '../src/ui/collection/view-pool';
import type { Entity } from '../src/types';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
// ---- Mock World (minimal surface ViewPool actually uses) ----
diff --git a/sdk/tests/ui-widget-prefabs.gen.test.ts b/sdk/tests/ui-widget-prefabs.gen.test.ts
index a42f0db32..feae78115 100644
--- a/sdk/tests/ui-widget-prefabs.gen.test.ts
+++ b/sdk/tests/ui-widget-prefabs.gen.test.ts
@@ -4,7 +4,7 @@
import { describe, it, expect, afterAll } from 'vitest';
import { writeFileSync, mkdirSync } from 'node:fs';
import { resolve } from 'node:path';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
import type { PrefabData } from '../src/prefab/types';
import { widgetToPrefab } from '../src/ui/widgets/toPrefab';
import { createButton } from '../src/ui/widgets/button';
@@ -17,7 +17,7 @@ import { createTextInput } from '../src/ui/widgets/text-input';
import { UISlider } from '../src/ui/behavior/slider';
import { UIToggle } from '../src/ui/behavior/toggle';
import { UIDropdown } from '../src/ui/behavior/dropdown';
-import { registerComponent } from '../src/component';
+import { registerComponent } from '../src/ecs/component';
import { spawnUIEntity } from '../src/ui/core/compose';
import { UIMask, MaskMode } from '../src/ui/core/ui-mask';
import { UIPositionType } from '../src/ui/core/ui-node';
diff --git a/sdk/tests/ui-widgets.test.ts b/sdk/tests/ui-widgets.test.ts
index c03481c72..3c51a9a08 100644
--- a/sdk/tests/ui-widgets.test.ts
+++ b/sdk/tests/ui-widgets.test.ts
@@ -28,7 +28,7 @@ import {
type UIGearData,
} from '../src/ui';
import type { Entity } from '../src/types';
-import type { World } from '../src/world';
+import type { World } from '../src/ecs/world';
// Minimal mock world — only the surface widgets + helpers touch.
diff --git a/sdk/tests/uniform-arity.test.ts b/sdk/tests/uniform-arity.test.ts
index ac1db17ab..2d4a5ef49 100644
--- a/sdk/tests/uniform-arity.test.ts
+++ b/sdk/tests/uniform-arity.test.ts
@@ -7,7 +7,7 @@
* binder. Previously each site had its own parallel branches.
*/
import { describe, expect, it } from 'vitest';
-import { classifyUniformArity } from '../src/material';
+import { classifyUniformArity } from '../src/render/material';
describe('classifyUniformArity', () => {
it('classifies a plain number as arity 1', () => {
diff --git a/sdk/tests/validation.test.ts b/sdk/tests/validation.test.ts
index 6a40e82e9..f69830e98 100644
--- a/sdk/tests/validation.test.ts
+++ b/sdk/tests/validation.test.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
-import { World } from '../src/world';
-import { defineComponent, defineTag } from '../src/component';
+import { World } from '../src/ecs/world';
+import { defineComponent, defineTag } from '../src/ecs/component';
describe('Component Data Validation', () => {
let world: World;
diff --git a/sdk/tests/velocity.test.ts b/sdk/tests/velocity.test.ts
index 5ae7f8b42..8f834e63b 100644
--- a/sdk/tests/velocity.test.ts
+++ b/sdk/tests/velocity.test.ts
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach } from 'vitest';
-import { World } from '../src/world';
-import { SystemRunner } from '../src/system';
-import { ResourceStorage, Time } from '../src/resource';
-import { EventRegistry } from '../src/event';
-import { Transform, Velocity, defineComponent } from '../src/component';
+import { World } from '../src/ecs/world';
+import { SystemRunner } from '../src/ecs/system';
+import { ResourceStorage, Time } from '../src/ecs/resource';
+import { EventRegistry } from '../src/ecs/event';
+import { Transform, Velocity, defineComponent } from '../src/ecs/component';
import { velocitySystem } from '../src/velocity';
import { createMockModule } from './mocks/wasm';
diff --git a/sdk/tests/video-ref-resolution.test.ts b/sdk/tests/video-ref-resolution.test.ts
index b64c15a9a..940be9cb7 100644
--- a/sdk/tests/video-ref-resolution.test.ts
+++ b/sdk/tests/video-ref-resolution.test.ts
@@ -9,9 +9,9 @@
* staged path IS the URL) and drew a blank white quad everywhere else.
*/
import { describe, it, expect } from 'vitest';
-import { loadRuntimeScene } from '../src/runtimeLoader';
+import { loadRuntimeScene } from '../src/runtime/runtimeLoader';
import { VideoPlayer } from '../src/video/VideoAPI';
-import { World } from '../src/world';
+import { World } from '../src/ecs/world';
import type { App } from '../src/app';
import type { Backend } from '../src/asset/Backend';
import type { ESEngineModule } from '../src/wasm';
diff --git a/sdk/tests/wasm-bridge.test.ts b/sdk/tests/wasm-bridge.test.ts
index ef77ba08b..0d8962b97 100644
--- a/sdk/tests/wasm-bridge.test.ts
+++ b/sdk/tests/wasm-bridge.test.ts
@@ -8,9 +8,9 @@
* the allocator pass straight through.
*/
import { describe, it, expect, vi } from 'vitest';
-import { WasmBridge } from '../src/WasmBridge';
-import { WasmModuleAborted, isModuleAborted } from '../src/moduleHealth';
-import { withMalloc } from '../src/wasmScratch';
+import { WasmBridge } from '../src/wasm/WasmBridge';
+import { WasmModuleAborted, isModuleAborted } from '../src/wasm/moduleHealth';
+import { withMalloc } from '../src/wasm/wasmScratch';
import { PhysicsBridge } from '../src/physics/PhysicsBridge';
import type { PhysicsWasmModule } from '../src/physics/PhysicsModuleLoader';
diff --git a/sdk/tests/wasm-scratch.test.ts b/sdk/tests/wasm-scratch.test.ts
index c0567a8b7..a341737a6 100644
--- a/sdk/tests/wasm-scratch.test.ts
+++ b/sdk/tests/wasm-scratch.test.ts
@@ -5,7 +5,7 @@
* @brief withScratch frees every allocation on normal return AND on throw.
*/
import { describe, it, expect } from 'vitest';
-import { withScratch, withMalloc, type WasmAllocator } from '../src/wasmScratch';
+import { withScratch, withMalloc, type WasmAllocator } from '../src/wasm/wasmScratch';
/** Fake allocator that hands out increasing pointers and records frees. */
function makeAllocator() {
diff --git a/sdk/tests/wasm-video-backend.test.ts b/sdk/tests/wasm-video-backend.test.ts
index 95165cdd2..32f27927e 100644
--- a/sdk/tests/wasm-video-backend.test.ts
+++ b/sdk/tests/wasm-video-backend.test.ts
@@ -8,7 +8,7 @@ import type { SideModuleHost } from '../src/sideModules/host';
import type { AudioAPI } from '../src/audio/Audio';
import type { AudioHandle } from '../src/audio/PlatformAudioBackend';
import { setPlatform } from '../src/platform/base';
-import { initResourceManager, shutdownResourceManager } from '../src/resourceManager';
+import { initResourceManager, shutdownResourceManager } from '../src/wasm/resourceManager';
import type { PlatformAdapter } from '../src/platform/types';
const WIDTH = 4, HEIGHT = 2;
diff --git a/sdk/tests/world.test.ts b/sdk/tests/world.test.ts
index f877e0991..044243823 100644
--- a/sdk/tests/world.test.ts
+++ b/sdk/tests/world.test.ts
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect, beforeEach, vi } from 'vitest';
-import { World, computeQueryCacheKey } from '../src/world';
-import { defineComponent, defineTag, defineBuiltin, Name } from '../src/component';
+import { World, computeQueryCacheKey } from '../src/ecs/world';
+import { defineComponent, defineTag, defineBuiltin, Name } from '../src/ecs/component';
import { createMockModule } from './mocks/wasm';
describe('World', () => {
diff --git a/tools/eht/__main__.py b/tools/eht/__main__.py
index 5f1ca2ccd..ed53b95a1 100644
--- a/tools/eht/__main__.py
+++ b/tools/eht/__main__.py
@@ -204,15 +204,15 @@ def main() -> int:
# ── TypeScript Definitions ──
ts_gen = TypeScriptGenerator(cpp_parser.components, cpp_parser.enums)
ts_content = ts_gen.generate()
- write_ts('wasm.generated.ts', ts_content)
+ write_ts('wasm/wasm.generated.ts', ts_content)
# ── Component Metadata ──
meta_gen = MetadataGenerator(cpp_parser.components, cpp_parser.enums, abi_hash=abi_hash)
- write_ts('component.generated.ts', meta_gen.generate())
+ write_ts('ecs/component.generated.ts', meta_gen.generate())
# ── Pointer Layouts & Accessors ──
- write_ts('ptrLayouts.generated.ts', ptr_gen.generate())
- write_ts('ecs/ptrAccessors.generated.ts', ptr_gen.generate_accessors())
+ write_ts('wasm/ptrLayouts.generated.ts', ptr_gen.generate())
+ write_ts('ecs/bridge/ptrAccessors.generated.ts', ptr_gen.generate_accessors())
print("[OK] Done!")
return 0
diff --git a/tools/eht/generators/metadata.py b/tools/eht/generators/metadata.py
index 82a33a4f0..48ebb76fc 100644
--- a/tools/eht/generators/metadata.py
+++ b/tools/eht/generators/metadata.py
@@ -278,13 +278,13 @@ class MetadataGenerator:
' * @details Generated by EHT - DO NOT EDIT',
' */',
'',
- "import type { AssetFieldType } from './scene';",
+ "import type { AssetFieldType } from '../scene';",
"import type { FieldMeta } from './component';",
]
if used_base:
- lines.append(f"import type {{ {', '.join(sorted(used_base))} }} from './types';")
+ lines.append(f"import type {{ {', '.join(sorted(used_base))} }} from '../types';")
if used_struct:
- lines.append(f"import type {{ {', '.join(sorted(used_struct))} }} from './wasm.generated';")
+ lines.append(f"import type {{ {', '.join(sorted(used_struct))} }} from '../wasm/wasm.generated';")
lines.append('')
lines += [
'/**',
diff --git a/tools/eht/generators/typescript.py b/tools/eht/generators/typescript.py
index abdc6a357..1697c89f2 100644
--- a/tools/eht/generators/typescript.py
+++ b/tools/eht/generators/typescript.py
@@ -27,7 +27,7 @@ class TypeScriptGenerator:
' * @details Generated by EHT - DO NOT EDIT',
' */',
'',
- "import type { Entity, Vec2, Vec3, Vec4, Quat } from './types';",
+ "import type { Entity, Vec2, Vec3, Vec4, Quat } from '../types';",
'',
'// Additional Math Types',
'export interface UVec2 { x: number; y: number; }',