Skip to content

Commit

Permalink
Use export (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
dumganhar authored Feb 26, 2025
1 parent d93aa95 commit efe7dc4
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 14 deletions.
3 changes: 0 additions & 3 deletions cocos/spine/lib/spine-define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,3 @@ export function overrideSpineDefine (wasm): void {
overrideProperty_Animation();
overrideProperty_Skeleton();
}

// To avoid cycle dependence: spine-version.ts -> spine-version-4.2.ts -> spine-wasm-utils.ts -> spine-define.ts -> spine-version.ts
(spine as any)._overrideSpineDefine = overrideSpineDefine;
1 change: 0 additions & 1 deletion cocos/spine/lib/spine-instantiate-3.8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { ensureWasmModuleReady } from 'pal/wasm';
import { error } from '../../core';
import { shouldUseWasmModule, initWasm, initAsmJS } from './spine-wasm-utils';


export function waitForSpineWasmInstantiation (): Promise<void> {
const errorReport = (msg: any): void => { error(msg); };
return ensureWasmModuleReady().then((): Promise<void> => {
Expand Down
1 change: 0 additions & 1 deletion cocos/spine/lib/spine-instantiate-4.2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { ensureWasmModuleReady } from 'pal/wasm';
import { error } from '../../core';
import { shouldUseWasmModule, initWasm, initAsmJS } from './spine-wasm-utils';


export function waitForSpineWasmInstantiation (): Promise<void> {
const errorReport = (msg: any): void => { error(msg); };
return ensureWasmModuleReady().then((): Promise<void> => {
Expand Down
6 changes: 6 additions & 0 deletions cocos/spine/lib/spine-instantiate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
THE SOFTWARE.
*/

// Defining the following import to make ts compiler know these files
// spine-instantiate.ts will be overriden by spine-instantiate-3.8.ts or spine-instantiate-4.2.ts while building engine.
// See 'moduleOverrides' section in cc.config.json.
import './spine-instantiate-3.8';
import './spine-instantiate-4.2';

export function waitForSpineWasmInstantiation (): Promise<void> {
return null!;
}
7 changes: 0 additions & 7 deletions cocos/spine/lib/spine-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,4 @@
THE SOFTWARE.
*/

// Defining the following import to make ts compiler know these files
// spine-version.ts will be overriden by spine-version-3.8.ts or spine-version-4.2.ts while building engine.
// See 'moduleOverrides' section in cc.config.json.
// Uncomment the following two lines while trying update the code in spine-version-[3.8 | 4.2].ts.
// import './spine-version-3.8';
// import './spine-version-4.2';

export const SPINE_VERSION = '3.8';
4 changes: 2 additions & 2 deletions cocos/spine/lib/spine-wasm-utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import spine from './spine-core';
import { instantiateWasm, fetchBuffer } from 'pal/wasm';
import { NATIVE_CODE_BUNDLE_MODE } from 'internal:constants';
import { sys } from '../../core';
import { NativeCodeBundleMode } from '../../misc/webassembly-support';
import { overrideSpineDefine } from './spine-define';

const PAGESIZE = 65536; // 64KiB

Expand Down Expand Up @@ -72,4 +72,4 @@ export function shouldUseWasmModule (): boolean {
}
}

registerList.push(spine._overrideSpineDefine);
registerList.push(overrideSpineDefine);

0 comments on commit efe7dc4

Please sign in to comment.