oak-domain 5.1.35 → 5.1.36

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.
@@ -12,6 +12,10 @@ const { factory } = ts;
12
12
  const NameSpaceDescDict = {};
13
13
  function checkPageDir(dir, relativePath, ns, type) {
14
14
  let changed = false;
15
+ // 确保命名空间已初始化
16
+ if (!NameSpaceDescDict[ns]) {
17
+ NameSpaceDescDict[ns] = { pages: {} };
18
+ }
15
19
  const { pages } = NameSpaceDescDict[ns];
16
20
  const subdirs = [];
17
21
  const files = (0, fs_extra_1.readdirSync)(dir);
@@ -219,6 +223,17 @@ function watchDir(projectDir, startupDir, type) {
219
223
  const relativeDir = (0, path_1.relative)((0, path_1.join)(projectDir, 'src', 'pages'), filepath);
220
224
  const ns = relativeDir.split('\\')[0];
221
225
  const relativePath = (0, path_1.relative)(ns, (0, path_1.dirname)(relativeDir));
226
+ // 检查命名空间是否已初始化,如果是新增的命名空间则进行初始化
227
+ if (!NameSpaceDescDict[ns]) {
228
+ const nsDir = (0, path_1.join)(projectDir, 'src', 'pages', ns);
229
+ if ((0, fs_extra_1.existsSync)(nsDir)) {
230
+ traverseNsDir(nsDir, ns, type);
231
+ }
232
+ else {
233
+ // 命名空间目录不存在,忽略此次变更
234
+ return;
235
+ }
236
+ }
222
237
  const { pages } = NameSpaceDescDict[ns];
223
238
  if (evt === 'remove') {
224
239
  if ((0, fs_extra_1.existsSync)(dir)) {
@@ -38,7 +38,27 @@ export type CompileOptions = {
38
38
  noEmit?: boolean;
39
39
  skipExtraCheck?: boolean;
40
40
  skipEmitDiagnostics?: boolean;
41
+ watch?: boolean;
41
42
  };
43
+ declare class CheckState {
44
+ functionsWithContextCalls: Set<ts.Symbol>;
45
+ functionDeclarations: Map<ts.Symbol, ts.FunctionLikeDeclaration>;
46
+ functionCallGraph: Map<ts.Symbol, Set<ts.Symbol>>;
47
+ directContextCalls: Map<ts.Symbol, ts.CallExpression[]>;
48
+ allContextCalls: ts.CallExpression[];
49
+ functionParameterHandling: Map<ts.Symbol, Map<number, boolean>>;
50
+ variableHandlingCache: Map<ts.Symbol, boolean>;
51
+ checkingVariables: Set<ts.Symbol>;
52
+ typeCache: Map<ts.Type, boolean>;
53
+ pathCache: Map<string, string>;
54
+ callsToCheckByFile: Map<ts.SourceFile, ts.CallExpression[]>;
55
+ ignoreCommentNodes: Map<ts.SourceFile, Set<ts.Node>>;
56
+ symbolCache: Map<ts.Node, ts.Symbol | undefined>;
57
+ tFunctionSymbolCache: Set<ts.CallExpression>;
58
+ fileToSymbols: Map<string, Set<ts.Symbol>>;
59
+ clearFileState(fileName: string): void;
60
+ clearSourceFileCache(sourceFile: ts.SourceFile): void;
61
+ }
42
62
  /**
43
63
  * 执行自定义检查
44
64
  * @param program ts.Program
@@ -46,6 +66,7 @@ export type CompileOptions = {
46
66
  * @param customConfig 自定义配置
47
67
  * @returns CustomDiagnostic[] 自定义诊断列表
48
68
  */
49
- export declare function performCustomChecks(pwd: string, program: ts.Program, typeChecker: ts.TypeChecker, customConfig: OakBuildChecksConfig): CustomDiagnostic[];
69
+ export declare function performCustomChecks(pwd: string, program: ts.Program, typeChecker: ts.TypeChecker, customConfig: OakBuildChecksConfig, state?: CheckState, // 状态对象
70
+ changedFiles?: Set<string>): CustomDiagnostic[];
50
71
  export declare const build: (pwd: string, args: any[]) => void;
51
72
  export {};