1
0

fix: 修复构建脚本跨平台 import specifier 路径规范化

- toImportSpecifier() 使用 replaceAll 替代 split(sep).join,明确 ESM import specifier 语义
- 增加 relativePath 可选参数支持测试注入 Windows relative 语义
- 重写 Windows 路径测试,使用 node:path.win32 显式模拟而非依赖当前平台 sep
- 更新 DEVELOPMENT.md 记录构建 code generation 约定
- 同步 static-asset-embedding 和 windows-test-compat spec 新增要求
This commit is contained in:
2026-05-21 09:32:43 +08:00
parent b432581444
commit 0d709c7681
5 changed files with 34 additions and 8 deletions

View File

@@ -1071,6 +1071,8 @@ bun run verify
`verify` 适合 CI 或正式提交前会完整验证类型检查、lint、格式、单元测试和生产构建。
**构建 code generation 约定**`scripts/build-common.ts` 中的 `toImportSpecifier()` 将文件系统相对路径转换为 ESM import specifier输出在所有平台上都必须使用 `/` 分隔符,不能包含 Windows 反斜杠。跨平台路径测试不得使用当前平台的 `path.sep` 伪装其他平台行为,应使用 `node:path.win32` 或等价注入方式显式模拟目标平台语义。
### 3.6 Executable/E2E 验证
`scripts/smoke.ts` 覆盖过薄,已从当前工作流移除。后续如需验证 production executable 的 API、静态资源服务、SPA fallback 行为,应重新设计独立的 executable/E2E 测试。