统一微信壳桥接目录

新增 miniprogram/shell 承接微信 Page 生命周期与 wx 容器调用

收窄微信页面入口为 shell 页面工厂装配

更新三端 host-bridge/shell 目录门禁与认证 smoke

补充微信 shell 测试与 CommonJS 测试加载工具

同步宿主壳架构文档和项目共享记忆

补齐 api-server 外部生成测试 fixture 更新时间字段
This commit is contained in:
2026-06-18 16:32:25 +08:00
parent 00b41b6a29
commit 7609c37d5f
24 changed files with 1449 additions and 1022 deletions
@@ -0,0 +1,31 @@
import { readFileSync } from 'node:fs';
import vm from 'node:vm';
export function loadCommonJsModule(filePath, requireMap = {}) {
const module = { exports: {} };
const sandbox = {
clearTimeout,
console,
getCurrentPages(...args) {
return globalThis.getCurrentPages(...args);
},
module,
exports: module.exports,
require(requestPath) {
if (Object.prototype.hasOwnProperty.call(requireMap, requestPath)) {
return requireMap[requestPath];
}
throw new Error(`Unexpected require: ${requestPath}`);
},
setTimeout,
URL,
URLSearchParams,
wx: globalThis.wx,
};
vm.runInNewContext(readFileSync(filePath, 'utf8'), sandbox, {
filename: filePath,
});
return module.exports;
}