Files
workinf_Blender_Wasm/docs/web/local-dependencies.md
2026-08-12 04:47:48 -04:00

32 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 本地依赖策略
浏览器运行时禁止从 CDN、远程 ESM 或第三方脚本地址加载功能模块。依赖分为
三类:
| 类别 | 当前模块 | 本地实现 |
| --- | --- | --- |
| 项目 vendored 运行时 | Three.js 0.185.1、OrbitControls、WebEngine glue/WASM | `web/app/src/vendor/``web/app/public/vendor/` |
| WASM 构建压缩库 | zlib 1.3.1、zstd 1.5.7 | `blender-5.2.0/extern/zlib/``blender-5.2.0/extern/zstd/`,由 Web CMake 的本地静态 target 使用 |
| npm 构建依赖 | React、ReactDOM、Vite、TypeScript | `web/package-lock.json` 锁定Vite 打入本地 `dist/assets/index-*.js` |
| 测试/工具依赖 | Playwright、ESLint、Emscripten | `web/node_modules`、系统 Emscripten 和本机 Chrome不进入浏览器产物 |
`tools/web/check-local-deps.sh` 是发布前门禁:检查 runtime dependencies 在本地
安装、Three.js 没有回退到 npm runtime import、vendor 资源存在,并扫描源码和
`dist/` 中的 CDN/远程 ESM 地址,同时按 `engine-manifest.json` 校验本地 WASM
SHA-256。npm registry 只发生在开发机首次安装阶段;发布/浏览器运行只提供
`web/dist` 的同源静态文件。离线开发需要预先保留 `node_modules` 或 npm
缓存,随后可用 `npm ci --offline` 重建,运行时不再访问 registry。
Blender Web CMake 不使用 `ExternalProject`、FetchContent 或构建时下载。zlib
和 zstd 的源码、许可证和 CMake 输入已放入 `blender-5.2.0/extern/`;浏览器只
加载 `web_engine.js` 与同源 `web_engine.wasm`,不加载 SQLite WASM、OCCT 或
任何远程模块。
可复现的离线检查命令:
```text
cd web
npm ci --offline --ignore-scripts
npm run check:local-deps
```