pose-gesture-sdk 0.0.0-stage → 1.2.0

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.
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * copy-assets.mjs
4
+ * 将 pose-gesture-sdk 包内内置的推理资源(assets/:wasm + vision_bundle.js + pose_landmarker.task)
5
+ * 拷贝到业务项目的公开目录,供浏览器通过 HTTP 加载(node_modules 内文件无法被浏览器直接访问)。
6
+ *
7
+ * 用法:
8
+ * node node_modules/pose-gesture-sdk/scripts/copy-assets.mjs --out=public/pose-gesture-sdk
9
+ * npm run copy-assets --prefix node_modules/pose-gesture-sdk -- --out=public/pose-gesture-sdk
10
+ *
11
+ * 默认输出目录:./public/pose-gesture-sdk
12
+ * 拷贝完成后,构建工具打包场景需在 SDK init 配置中显式传入三个资源路径(modelUrl / wasmUrl / mediapipeJsUrl)
13
+ * 指向该公开目录(如 '/public/pose-gesture-sdk/pose_landmarker.task' 等)。
14
+ *(浏览器 <script> 引入场景无需本脚本与路径配置:SDK 自动定位包内 assets/ 资源。)
15
+ */
16
+ import { cpSync, mkdirSync, existsSync } from 'node:fs';
17
+ import { dirname, join, resolve } from 'node:path';
18
+ import { fileURLToPath } from 'node:url';
19
+
20
+ // 包根目录(本文件位于 <pkg>/scripts/ 下)
21
+ const PKG_DIR = resolve(dirname(fileURLToPath(import.meta.url)), '..');
22
+ const ASSETS_DIR = join(PKG_DIR, 'assets');
23
+
24
+ // 解析 --out=xxx 参数,默认 ./public/pose-gesture-sdk
25
+ const outArg = process.argv.find((a) => a.startsWith('--out='));
26
+ const OUT_DIR = resolve(outArg ? outArg.slice('--out='.length) : 'public/pose-gesture-sdk');
27
+
28
+ if (!existsSync(ASSETS_DIR)) {
29
+ console.error('[pose-gesture-sdk] 未找到包内置资源目录:', ASSETS_DIR);
30
+ process.exit(1);
31
+ }
32
+
33
+ mkdirSync(OUT_DIR, { recursive: true });
34
+ cpSync(ASSETS_DIR, OUT_DIR, { recursive: true });
35
+
36
+ console.log('[pose-gesture-sdk] 推理资源已拷贝到:', OUT_DIR);
37
+ // 公开访问路径提示(保证以 / 开头,直接可拷贝到 SDK init 配置中)
38
+ var PUB = '/' + (outArg ? outArg.slice(6) : 'public/pose-gesture-sdk').replace(/^\/+|\/+$/g, '');
39
+ console.log('[pose-gesture-sdk] 构建工具打包场景请在 SDK init 配置中显式传入资源路径:');
40
+ console.log(' modelUrl: "' + PUB + '/pose_landmarker.task"');
41
+ console.log(' wasmUrl: "' + PUB + '/wasm"');
42
+ console.log(' mediapipeJsUrl: "' + PUB + '/vision_bundle.js"');
43
+ console.log('(浏览器 <script> 引入场景无需以上配置:SDK 自动使用包内 assets/ 资源)');
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.