-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtypes.d.ts
82 lines (71 loc) · 3.13 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { Logger } from "vite";
import { ChildProcessWithoutNullStreams } from "node:child_process";
import { Subscription } from "rxjs";
import { JSONRPCEndpoint } from "ts-lsp-client";
// Represents a generic F# discriminated union case with associated fields.
export interface FSharpDiscriminatedUnion {
case: string; // The name of the case (mirroring the F# case name)
fields: any[]; // The fields associated with the case
}
// Represents options for an F# project.
export interface FSharpProjectOptions {
sourceFiles: string[]; // List of source files in the project
}
// Defines a range within a file, used for diagnostics or annotations.
export interface DiagnosticRange {
startLine: number; // The start line of the diagnostic range
startColumn: number; // The start column of the diagnostic range
endLine: number; // The end line of the diagnostic range
endColumn: number; // The end column of the diagnostic range
}
// Describes a diagnostic message, typically an error or warning, within a file.
export interface Diagnostic {
errorNumberText: string; // The error number or identifier text
message: string; // The descriptive diagnostic message
range: DiagnosticRange; // The range within the file where the diagnostic applies
severity: string; // The severity of the diagnostic (e.g., error, warning)
fileName: string; // The name of the file containing the diagnostic
}
export interface PluginOptions {
fsproj?: string; // Optional: The main fsproj to load
jsx?: "transform" | "preserve" | "automatic" | null; // Optional: Apply JSX transformation after Fable compilation
noReflection?: boolean; // Optional: Pass noReflection value to Fable.Compiler
exclude?: string[]; // Optional: Pass exclude to Fable.Compiler
}
export interface PluginState {
config: PluginOptions;
logger: Logger;
dotnetProcess: ChildProcessWithoutNullStreams | null;
endpoint: JSONRPCEndpoint | null;
compilableFiles: Map<string, string>;
sourceFiles: Set<string>;
fsproj: string | null;
configuration: string;
dependentFiles: Set<string>;
pendingChanges: Subscription | null;
hotPromiseWithResolvers: PromiseWithResolvers<Array<Diagnostic>>;
isBuild: boolean;
}
// Represents an event where an F# file has changed.
export interface FSharpFileChanged {
type: "FSharpFileChanged"; // Discriminator for FSharpFileChanged event type
file: string; // The F# file that changed
}
// Represents an event where a project file has changed.
export interface ProjectFileChanged {
type: "ProjectFileChanged"; // Discriminator for ProjectFileChanged event type
file: string; // The project file that changed
}
// Type that represents the possible hook events. Acts as a discriminated union in TypeScript.
export type HookEvent = FSharpFileChanged | ProjectFileChanged;
// Represents the state of pending changes.
export interface PendingChangesState {
projectChanged: boolean; // Indicates whether the project changed
fsharpFiles: Set<string>; // Set of changed F# files
projectFiles: Set<string>; // Set of changed project files
}
export interface ProjectFileData {
sourceFiles: string[];
diagnostics: Diagnostic[];
dependentFiles: string[];
}