@faapi/faapi 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +480 -339
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +375 -234
- package/dist/index.js.map +1 -1
- package/dist/testing.js +303 -163
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -607,17 +607,28 @@ interface WsContext {
|
|
|
607
607
|
type WsHandler = (ctx: WsContext) => WsEventHandlers | void;
|
|
608
608
|
|
|
609
609
|
/**
|
|
610
|
-
* 清理所有 Program
|
|
610
|
+
* 清理所有 Program 缓存 + tsconfig 解析缓存(watch 模式下文件变化时调用)
|
|
611
611
|
*
|
|
612
612
|
* 全量清理而非增量清理,理由:
|
|
613
613
|
* - 简单可靠,无状态一致性问题
|
|
614
614
|
* - 跨文件类型引用需要所有文件的 Program 同步更新
|
|
615
|
+
* - tsconfig 可能变化,需重新读取
|
|
615
616
|
* - dev 模式文件量有限,全量重建在百毫秒级
|
|
616
617
|
*/
|
|
617
618
|
declare function invalidateProgramCache(): void;
|
|
618
619
|
/**
|
|
619
620
|
* 为指定文件创建 TypeScript Program(带缓存)
|
|
620
621
|
*
|
|
622
|
+
* 从 filePath 向上查找最近的 tsconfig.json:
|
|
623
|
+
* - 找到:用 ts.parseJsonConfigFileContent 解析,取 module / moduleResolution
|
|
624
|
+
* 覆盖默认值,同时取 parsed.fileNames 作为 program 的 rootNames(让跨文件
|
|
625
|
+
* import 的源文件被加载进 program)
|
|
626
|
+
* - 找不到(如 os.tmpdir() 测试场景):回退到默认 NodeNext,rootNames 仅包含 filePath
|
|
627
|
+
*
|
|
628
|
+
* 加载全部相关文件保证 `resolveTypeReference` 的兜底遍历(找同名声明)能成功,
|
|
629
|
+
* 修复业务项目用 `moduleResolution: Bundler` + 无扩展名相对导入时跨文件
|
|
630
|
+
* `import type` 解析失败的问题。
|
|
631
|
+
*
|
|
621
632
|
* @param filePath 要分析的 .ts 文件绝对路径
|
|
622
633
|
*/
|
|
623
634
|
declare function createProgram(filePath: string): ts.Program;
|