feat: 遮蔽产物中的 Taro 指纹
H5 预览与小程序产物会带出 taro_tmpl、taro-*-core、taro.js、--taro-button-height、 project.config.json 的 projectname 等指纹,而 Taro 4.3 没有隐藏这些名称的配置。 改为在 build:h5、build:weapp、build:preview 之后按 apps/taro/config/mask.config.json 做构建后处理: - 同一张替换表同时作用于文件名与文本内容,重命名后引用保持同步,长度 ≥ 40 的 base64/哈希片段原样保留; - 遮蔽后仍命中 forbidden 词表时构建失败,并把 project.config.json 的 projectname/description 中性化; - dev:h5、dev:preview 保持原始命名,便于本地调试;改架构名只改 mask.config.json; - 产物契约测试先用 unmask() 还原再断言,浏览器测试选择器写成 :is(<源码名>, <遮蔽名>)。 取舍与迁移见 docs/adr/0025-build-output-stack-masking.md。
This commit is contained in:
1 parent
53713e5935
commit
9ad2776515
13 files changed
+382
-10
No files matched your search
@@ -4,9 +4,9 @@
|
||||
"scripts": {
|
||||
"dev:h5": "taro build --type h5 --watch",
|
||||
"dev:preview": "PREVIEW_ALL_TEMPLATES=true taro build --type h5 --watch",
|
||||
"build:h5": "taro build --type h5",
|
||||
"build:preview": "PREVIEW_ALL_TEMPLATES=true taro build --type h5",
|
||||
"build:weapp": "taro build --type weapp",
|
||||
"build:h5": "taro build --type h5 && node config/mask-taro.cjs h5",
|
||||
"build:preview": "PREVIEW_ALL_TEMPLATES=true taro build --type h5 && node config/mask-taro.cjs h5 --preview",
|
||||
"build:weapp": "taro build --type weapp && node config/mask-taro.cjs weapp",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"lint": "pnpm --workspace-root exec eslint apps/taro/src apps/taro/config \"packages/template-*/taro/**/*.{ts,tsx}\"",
|
||||
"test": "node --experimental-strip-types --test test/*.test.mjs",
|
||||
|
||||
Reference in new issue
Block a user