@spatialwalk/avatarkit 1.0.0-beta.66 → 1.0.0-beta.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -9
- package/dist/{StreamingAudioPlayer-Dm6v2zbj.js → StreamingAudioPlayer-DrTBMLSq.js} +1 -1
- package/dist/avatar_core_wasm-Dv943JJl.js +1 -1
- package/dist/{index-zj_wtoEC.js → index-CF8Fvg7k.js} +3 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/vite.js +45 -29
- /package/dist/{avatar_core_wasm.wasm → avatar_core_wasm-e68766db.wasm} +0 -0
|
@@ -7624,7 +7624,7 @@ const _AnimationPlayer = class _AnimationPlayer {
|
|
|
7624
7624
|
if (this.streamingPlayer) {
|
|
7625
7625
|
return;
|
|
7626
7626
|
}
|
|
7627
|
-
const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-
|
|
7627
|
+
const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-DrTBMLSq.js");
|
|
7628
7628
|
const { AvatarSDK: AvatarSDK2 } = await Promise.resolve().then(() => AvatarSDK$1);
|
|
7629
7629
|
const audioFormat = AvatarSDK2.getAudioFormat();
|
|
7630
7630
|
this.streamingPlayer = new StreamingAudioPlayer({
|
|
@@ -8961,7 +8961,7 @@ class AvatarSDK {
|
|
|
8961
8961
|
}
|
|
8962
8962
|
__publicField(AvatarSDK, "_isInitialized", false);
|
|
8963
8963
|
__publicField(AvatarSDK, "_configuration", null);
|
|
8964
|
-
__publicField(AvatarSDK, "_version", "1.0.0-beta.
|
|
8964
|
+
__publicField(AvatarSDK, "_version", "1.0.0-beta.68");
|
|
8965
8965
|
__publicField(AvatarSDK, "_avatarCore", null);
|
|
8966
8966
|
__publicField(AvatarSDK, "_dynamicSdkConfig", null);
|
|
8967
8967
|
const AvatarSDK$1 = Object.freeze(Object.defineProperty({
|
|
@@ -11841,7 +11841,7 @@ const _PwaCacheManager = class _PwaCacheManager {
|
|
|
11841
11841
|
}
|
|
11842
11842
|
}
|
|
11843
11843
|
};
|
|
11844
|
-
__publicField(_PwaCacheManager, "TEMPLATE_RESOURCE_VERSION", "1.0.
|
|
11844
|
+
__publicField(_PwaCacheManager, "TEMPLATE_RESOURCE_VERSION", "1.0.0");
|
|
11845
11845
|
__publicField(_PwaCacheManager, "TEMPLATE_CACHE_NAME", `spatialwalk-sdk-template-cache-${_PwaCacheManager.TEMPLATE_RESOURCE_VERSION}`);
|
|
11846
11846
|
__publicField(_PwaCacheManager, "TEMPLATE_VERSION_STORAGE_KEY", "spatialwalk-sdk-template-cache-version");
|
|
11847
11847
|
__publicField(_PwaCacheManager, "CHARACTER_CACHE_PREFIX", "spatialwalk-sdk-character-");
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
package/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { copyFileSync, existsSync, writeFileSync, readdirSync } from 'node:fs';
|
|
1
|
+
import { copyFileSync, existsSync, writeFileSync, readdirSync, readFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
/**
|
|
4
4
|
* Vite plugin for @spatialwalk/avatarkit
|
|
@@ -37,43 +37,59 @@ export function avatarkitVitePlugin() {
|
|
|
37
37
|
closeBundle() {
|
|
38
38
|
if (!rootDir)
|
|
39
39
|
return;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
const wasmSourceDir = join(rootDir, 'node_modules/@spatialwalk/avatarkit/dist');
|
|
41
|
+
// 先查找并读取 JS glue 文件,提取它引用的 WASM 文件名
|
|
42
|
+
let wasmFileName = null;
|
|
43
|
+
if (existsSync(wasmSourceDir)) {
|
|
44
|
+
const files = readdirSync(wasmSourceDir);
|
|
45
|
+
const wasmJsFile = files.find((f) => f.startsWith('avatar_core_wasm') && f.endsWith('.js'));
|
|
46
|
+
if (wasmJsFile) {
|
|
47
|
+
const wasmJsSource = join(wasmSourceDir, wasmJsFile);
|
|
48
|
+
try {
|
|
49
|
+
const jsContent = readFileSync(wasmJsSource, 'utf-8');
|
|
50
|
+
// 从 JS 文件中提取 WASM 文件名
|
|
51
|
+
// 匹配 avatar_core_wasm-{hash}.wasm 或 avatar_core_wasm.wasm
|
|
52
|
+
// 使用更精确的正则,匹配带引号或不带引号的情况
|
|
53
|
+
const wasmMatch = jsContent.match(/["'`]?avatar_core_wasm[-\w]*\.wasm["'`]?/g);
|
|
54
|
+
if (wasmMatch && wasmMatch.length > 0) {
|
|
55
|
+
// 取第一个匹配,去掉引号
|
|
56
|
+
wasmFileName = wasmMatch[0].replace(/["'`]/g, '');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.warn('⚠️ [avatarkit] Could not read JS glue file:', error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// 如果从 JS 文件中找到了 WASM 文件名,使用它;否则回退到默认名称
|
|
65
|
+
const targetWasmName = wasmFileName || 'avatar_core_wasm.wasm';
|
|
66
|
+
const wasmSource = join(wasmSourceDir, targetWasmName);
|
|
67
|
+
const wasmDest = join(rootDir, `dist/assets/${targetWasmName}`);
|
|
48
68
|
const wasmJsDest = join(rootDir, 'dist/assets/avatar_core_wasm.js');
|
|
49
69
|
const headersDest = join(rootDir, 'dist/_headers');
|
|
50
70
|
// 复制 WASM 文件
|
|
51
71
|
if (existsSync(wasmSource)) {
|
|
52
72
|
copyFileSync(wasmSource, wasmDest);
|
|
53
|
-
console.log(
|
|
73
|
+
console.log(`✅ [avatarkit] Copied WASM file to dist/assets/${targetWasmName}`);
|
|
54
74
|
}
|
|
55
75
|
else {
|
|
56
|
-
console.warn(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// 由于 Vite 可能会给文件加 hash,我们尝试查找匹配的文件
|
|
60
|
-
try {
|
|
61
|
-
if (existsSync(wasmJsSourcePattern)) {
|
|
62
|
-
const files = readdirSync(wasmJsSourcePattern);
|
|
63
|
-
const wasmJsFile = files.find((f) => f.startsWith('avatar_core_wasm') && f.endsWith('.js'));
|
|
64
|
-
if (wasmJsFile) {
|
|
65
|
-
const wasmJsSource = join(wasmJsSourcePattern, wasmJsFile);
|
|
66
|
-
copyFileSync(wasmJsSource, wasmJsDest);
|
|
67
|
-
console.log(`✅ [avatarkit] Copied WASM JS file to dist/assets/avatar_core_wasm.js (from ${wasmJsFile})`);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
console.log('ℹ️ [avatarkit] WASM JS file not found (may be handled by Vite):', wasmJsSourcePattern);
|
|
71
|
-
}
|
|
76
|
+
console.warn(`⚠️ [avatarkit] WASM file not found: ${wasmSource}`);
|
|
77
|
+
if (wasmFileName) {
|
|
78
|
+
console.warn(` Expected file: ${targetWasmName} (extracted from JS glue file)`);
|
|
72
79
|
}
|
|
73
80
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
81
|
+
// 复制 WASM JS glue 文件
|
|
82
|
+
if (existsSync(wasmSourceDir)) {
|
|
83
|
+
const files = readdirSync(wasmSourceDir);
|
|
84
|
+
const wasmJsFile = files.find((f) => f.startsWith('avatar_core_wasm') && f.endsWith('.js'));
|
|
85
|
+
if (wasmJsFile) {
|
|
86
|
+
const wasmJsSource = join(wasmSourceDir, wasmJsFile);
|
|
87
|
+
copyFileSync(wasmJsSource, wasmJsDest);
|
|
88
|
+
console.log(`✅ [avatarkit] Copied WASM JS file to dist/assets/avatar_core_wasm.js (from ${wasmJsFile})`);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
console.log('ℹ️ [avatarkit] WASM JS file not found (may be handled by Vite):', wasmSourceDir);
|
|
92
|
+
}
|
|
77
93
|
}
|
|
78
94
|
// 生成 _headers 文件(用于 Cloudflare Pages 等平台)
|
|
79
95
|
const headersContent = '/*.wasm\n Content-Type: application/wasm\n';
|
|
File without changes
|