docs(scripts): explain build and icon generation boundaries
This commit is contained in:
@@ -9,6 +9,7 @@ import { join, resolve } from 'node:path';
|
||||
|
||||
// 路径基于脚本URL而非当前终端目录;tsc仍显式以仓库根作为cwd解析项目依赖。
|
||||
const root=resolve(fileURLToPath(new URL('..',import.meta.url))),output=join(root,'.headless-dist');
|
||||
// 原产物先删除,后续任一步失败不会恢复上一版;调用方须通过脚本成功退出和包验收后才采用目录。
|
||||
await rm(output,{recursive:true,force:true});
|
||||
// 同步等待TypeScript生成ESM及声明;继承终端输出,编译失败直接中止后续处理。
|
||||
execFileSync(process.execPath,[join(root,'node_modules/typescript/bin/tsc'),'-p',join(root,'tsconfig.headless.json')],{cwd:root,stdio:'inherit'});
|
||||
@@ -28,6 +29,7 @@ async function declarations(directory){
|
||||
}
|
||||
}
|
||||
// 原生编译器处理运行时import后缀,声明文件仍需此补充;完成后再修URL字面量里的Worker源后缀。
|
||||
// 后处理逐文件直接写入,未使用临时目录整体 rename;中途错误可留下部分已改写的输出。
|
||||
await declarations(join(output,'modules'));
|
||||
// 两个浏览器适配器各应含一个预期Worker URL;要求目标.js文件存在并且源字符串只出现一次才改写。
|
||||
for(const [module,worker]of [['browser-digests','digest.worker'],['browser-images','image.worker']]){
|
||||
|
||||
Reference in New Issue
Block a user