|
1 | 1 | import { BirpcReturn } from 'birpc'; |
2 | 2 | import { type Dree } from 'dree'; |
3 | | -import { VARIABLE_DECLARATION_LIST, EXPRESSION_STATEMENT_LIST } from './constants'; |
| 3 | +import { |
| 4 | + VARIABLE_DECLARATION_LIST, |
| 5 | + EXPRESSION_STATEMENT_LIST, |
| 6 | +} from './constants'; |
| 7 | + |
4 | 8 | export { Type as RouteType } from 'dree'; |
5 | 9 |
|
6 | 10 | export interface ClientFunctions { |
7 | 11 | healthCheck(): boolean; |
8 | 12 | } |
9 | 13 |
|
| 14 | +export interface DependenciesStatus { |
| 15 | + phase: 'idle' | 'phase1' | 'phase2' | 'done' | 'error'; |
| 16 | + loaded: number; |
| 17 | + total: number; |
| 18 | + startedAt: number | null; |
| 19 | + finishedAt: number | null; |
| 20 | + error?: string; |
| 21 | +} |
| 22 | + |
| 23 | +export interface PackageInstallResult { |
| 24 | + success: boolean; |
| 25 | + error?: string; |
| 26 | +} |
| 27 | + |
| 28 | +export interface BuildAnalysisStatus { |
| 29 | + exists: boolean; |
| 30 | + reportPath: string; |
| 31 | + buildCommand: string | null; |
| 32 | +} |
| 33 | + |
| 34 | +export interface BuildAnalysisRunResult { |
| 35 | + success: boolean; |
| 36 | + error?: string; |
| 37 | +} |
| 38 | + |
| 39 | +export interface ModuleLookupResult { |
| 40 | + pathId: string; |
| 41 | + modules: any; |
| 42 | + error?: string; |
| 43 | +} |
| 44 | + |
| 45 | +export type ParsedQwikCodeResult = Omit<ParsedStructure, '__start__'>[]; |
| 46 | + |
10 | 47 | export interface ServerFunctions { |
11 | 48 | healthCheck(): boolean; |
12 | 49 | getAssetsFromPublicDir: () => Promise<AssetInfo[]>; |
13 | 50 | getComponents: () => Promise<Component[]>; |
14 | 51 | getRoutes: () => any; |
15 | 52 | getQwikPackages: () => Promise<[string, string][]>; |
16 | 53 | getAllDependencies: () => Promise<any[]>; |
17 | | - getDependenciesStatus: () => Promise<{ |
18 | | - phase: 'idle' | 'phase1' | 'phase2' | 'done' | 'error'; |
19 | | - loaded: number; |
20 | | - total: number; |
21 | | - startedAt: number | null; |
22 | | - finishedAt: number | null; |
23 | | - error?: string; |
24 | | - }>; |
| 54 | + getDependenciesStatus: () => Promise<DependenciesStatus>; |
25 | 55 | refreshDependencies: () => Promise<void>; |
26 | 56 | installPackage: ( |
27 | 57 | packageName: string, |
28 | 58 | isDev?: boolean, |
29 | | - ) => Promise<{ success: boolean; error?: string }>; |
30 | | - getModulesByPathIds: (pathIds: string | string[]) => Promise<{ |
31 | | - pathId: string; |
32 | | - modules: any; |
33 | | - error?: string; |
34 | | - }[]>; |
35 | | - parseQwikCode: (code: string) => Promise<Omit<ParsedStructure, '__start__'>[]>; |
| 59 | + ) => Promise<PackageInstallResult>; |
| 60 | + getBuildAnalysisStatus: () => Promise<BuildAnalysisStatus>; |
| 61 | + buildBuildAnalysisReport: () => Promise<BuildAnalysisRunResult>; |
| 62 | + getModulesByPathIds: ( |
| 63 | + pathIds: string | string[], |
| 64 | + ) => Promise<ModuleLookupResult[]>; |
| 65 | + parseQwikCode: (code: string) => Promise<ParsedQwikCodeResult>; |
36 | 66 | } |
37 | 67 |
|
38 | 68 | export type ServerRpc = BirpcReturn<ClientFunctions, ServerFunctions>; |
@@ -75,17 +105,19 @@ export interface Component { |
75 | 105 | file: string; |
76 | 106 | } |
77 | 107 |
|
78 | | -export type Category = 'variableDeclaration' | 'expressionStatement' | 'listener' |
| 108 | +export type Category = |
| 109 | + | 'variableDeclaration' |
| 110 | + | 'expressionStatement' |
| 111 | + | 'listener'; |
79 | 112 | export type HookType = |
80 | 113 | | (typeof VARIABLE_DECLARATION_LIST)[number] |
81 | 114 | | (typeof EXPRESSION_STATEMENT_LIST)[number] |
82 | | - | 'customhook' |
| 115 | + | 'customhook'; |
83 | 116 |
|
84 | 117 | export interface ParsedStructure { |
85 | | - variableName: string |
86 | | - hookType: HookType |
87 | | - category: Category |
88 | | - __start__?: number |
89 | | - data?: any |
| 118 | + variableName: string; |
| 119 | + hookType: HookType; |
| 120 | + category: Category; |
| 121 | + __start__?: number; |
| 122 | + data?: any; |
90 | 123 | } |
91 | | - |
|
0 commit comments