Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(native): a packaged game script gets the three new subpaths

esengine50e2371d0e4d
diff --git a/sdk/src/platform/nativeModuleRegistry.ts b/sdk/src/platform/nativeModuleRegistry.ts
index da4696f9b..47e14dcc4 100644
--- a/sdk/src/platform/nativeModuleRegistry.ts
+++ b/sdk/src/platform/nativeModuleRegistry.ts
@@ -23,6 +23,9 @@ import * as Physics2DModule from '../physics';
import * as Physics3DModule from '../physics3d';
import * as SpineModule from '../spine';
import * as DragonBonesModule from '../dragonbones';
+import * as TilemapModule from '../tilemap';
+import * as ScriptGraphModule from '../logic';
+import * as AiModule from '../ai';
/** Must equal NATIVE_MODULE_REGISTRY in tools/nativeScriptModules.mjs, which is
* what the exporter emits and what check-native-script-modules reads. */
@@ -37,6 +40,9 @@ export const NATIVE_MODULE_NAMESPACES: Readonly<Record<string, unknown>> = {
'esengine/physics3d': Physics3DModule,
'esengine/spine': SpineModule,
'esengine/dragonbones': DragonBonesModule,
+ 'esengine/tilemap': TilemapModule,
+ 'esengine/logic': ScriptGraphModule,
+ 'esengine/ai': AiModule,
};
/**
diff --git a/sdk/tests/native-module-identity.test.ts b/sdk/tests/native-module-identity.test.ts
index eb67822f6..9d01f7582 100644
--- a/sdk/tests/native-module-identity.test.ts
+++ b/sdk/tests/native-module-identity.test.ts
@@ -14,6 +14,7 @@
*/
import { describe, it, expect } from 'vitest';
import { App } from '../src/app/app';
+import { MODULES } from '../../tools/nativeScriptModules.js';
import { defineResource } from '../src/ecs/resource';
import { Physics3D, Physics3DPlugin } from '../src/physics3d/Physics3DPlugin';
import { Physics2D } from '../src/physics/Physics2DPlugin';
@@ -28,9 +29,13 @@ const imported = (specifier: string): Record<string, unknown> =>
describe('native subpath modules resolve to this graph', () => {
it('publishes a namespace for every subpath a project may import', () => {
- expect(Object.keys(NATIVE_MODULE_NAMESPACES).sort()).toEqual([
- 'esengine/dragonbones', 'esengine/physics', 'esengine/physics3d', 'esengine/spine',
- ]);
+ // From the dispositions rather than a list kept here: a subpath added to
+ // one and not the other resolves to nothing on a device, and a hand-kept
+ // copy is the thing that goes stale.
+ const owed = Object.entries(MODULES)
+ .filter(([, m]) => m.disposition === 'native-subpath')
+ .map(([specifier]) => specifier).sort();
+ expect(Object.keys(NATIVE_MODULE_NAMESPACES).sort()).toEqual(owed);
});
it('carries the exports the core namespace does not', () => {
diff --git a/tools/nativeScriptModules.js b/tools/nativeScriptModules.js
index a6461b4b1..88c2bdfa0 100644
--- a/tools/nativeScriptModules.js
+++ b/tools/nativeScriptModules.js
@@ -64,6 +64,9 @@ export const MODULES = {
'esengine/physics3d': { disposition: 'native-subpath' },
'esengine/spine': { disposition: 'native-subpath' },
'esengine/dragonbones': { disposition: 'native-subpath' },
+ 'esengine/tilemap': { disposition: 'native-subpath' },
+ 'esengine/logic': { disposition: 'native-subpath' },
+ 'esengine/ai': { disposition: 'native-subpath' },
'esengine/native': {
disposition: 'forbidden-native-script',
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index 92baca6a5..aca54a85c 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -690,6 +690,8 @@ export const NOTED = {
{ internal: 'the wording of a message the export already printed' },
'fix(details): the Inspector names the new reason a texture ships raw':
{ note: 'A texture that encodes larger than its source now ships as the source.' },
+ 'fix(native): a packaged game script gets the three new subpaths':
+ { internal: 'what a native host publishes to the scripts it runs' },
'fix(app): build order is declared, not the shape of an array':
{ internal: 'the order a stack of plugins is assembled in' },
'docs(manual): the AI, tilemap and script-graph pages import from their subpaths':