autolang-compiler 0.0.5 → 0.0.7

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/index.d.mts CHANGED
@@ -1,20 +1,33 @@
1
- type AutolangPointer = number;
2
- type AutolangType = number | null | undefined | string | boolean | void | AutolangPointer;
3
- type AutolangArgs = AutolangType[];
4
- type AutolangNativeFunc = (args: AutolangArgs) => AutolangType;
1
+ type AObject = number;
2
+ type AutolangType = number | null | undefined | string | boolean | void | AObject;
3
+ type AutolangNativeFunc = (thisArg: AutolangType, ...args: AutolangType[]) => (number | null | string | boolean | void);
4
+ interface LibraryConfig {
5
+ autoImport?: boolean;
6
+ allowLateinitKeyword?: boolean;
7
+ allowNonNullAssertion?: boolean;
8
+ }
9
+ interface AException {
10
+ message: string;
11
+ }
5
12
  declare class ACompiler {
6
13
  private instance;
7
- outputBuffer: string;
8
14
  private constructor();
9
15
  static create(customWasmUrl?: string): Promise<ACompiler>;
10
- registerBuiltInLibrary(name: string, source: string, autoImport: boolean | undefined, methods: Record<string, AutolangNativeFunc>): void;
16
+ getOutput(): any;
17
+ clearOutput(): void;
18
+ registerBuiltInLibrary(name: string, source: string, config?: LibraryConfig, methods?: Record<string, AutolangNativeFunc>): void;
19
+ setMainSourceConfig(config: LibraryConfig): void;
20
+ setLimitOpcodeCount(limit: number): void;
11
21
  compileAndRun(path: string, code: string): boolean;
12
22
  compile(path: string, code: string): boolean;
13
23
  run(): boolean;
14
- hasError(): boolean;
15
- setOnError(callback: (error: string) => void): void;
16
- setOnWarning(callback: (warning: string) => void): void;
24
+ hasCompilerError(): boolean;
25
+ throwException(message: string): boolean;
26
+ hasException(): boolean;
27
+ getException(): AException | null;
28
+ setOnError(callback: ((error: string) => void) | null): void;
29
+ setOnWarning(callback: ((warning: string) => void) | null): void;
17
30
  refresh(): void;
18
31
  }
19
32
 
20
- export { ACompiler, type AutolangArgs, type AutolangNativeFunc, type AutolangPointer, type AutolangType };
33
+ export { ACompiler, type AException, type AObject, type AutolangNativeFunc, type AutolangType, type LibraryConfig };
package/dist/index.d.ts CHANGED
@@ -1,20 +1,33 @@
1
- type AutolangPointer = number;
2
- type AutolangType = number | null | undefined | string | boolean | void | AutolangPointer;
3
- type AutolangArgs = AutolangType[];
4
- type AutolangNativeFunc = (args: AutolangArgs) => AutolangType;
1
+ type AObject = number;
2
+ type AutolangType = number | null | undefined | string | boolean | void | AObject;
3
+ type AutolangNativeFunc = (thisArg: AutolangType, ...args: AutolangType[]) => (number | null | string | boolean | void);
4
+ interface LibraryConfig {
5
+ autoImport?: boolean;
6
+ allowLateinitKeyword?: boolean;
7
+ allowNonNullAssertion?: boolean;
8
+ }
9
+ interface AException {
10
+ message: string;
11
+ }
5
12
  declare class ACompiler {
6
13
  private instance;
7
- outputBuffer: string;
8
14
  private constructor();
9
15
  static create(customWasmUrl?: string): Promise<ACompiler>;
10
- registerBuiltInLibrary(name: string, source: string, autoImport: boolean | undefined, methods: Record<string, AutolangNativeFunc>): void;
16
+ getOutput(): any;
17
+ clearOutput(): void;
18
+ registerBuiltInLibrary(name: string, source: string, config?: LibraryConfig, methods?: Record<string, AutolangNativeFunc>): void;
19
+ setMainSourceConfig(config: LibraryConfig): void;
20
+ setLimitOpcodeCount(limit: number): void;
11
21
  compileAndRun(path: string, code: string): boolean;
12
22
  compile(path: string, code: string): boolean;
13
23
  run(): boolean;
14
- hasError(): boolean;
15
- setOnError(callback: (error: string) => void): void;
16
- setOnWarning(callback: (warning: string) => void): void;
24
+ hasCompilerError(): boolean;
25
+ throwException(message: string): boolean;
26
+ hasException(): boolean;
27
+ getException(): AException | null;
28
+ setOnError(callback: ((error: string) => void) | null): void;
29
+ setOnWarning(callback: ((warning: string) => void) | null): void;
17
30
  refresh(): void;
18
31
  }
19
32
 
20
- export { ACompiler, type AutolangArgs, type AutolangNativeFunc, type AutolangPointer, type AutolangType };
33
+ export { ACompiler, type AException, type AObject, type AutolangNativeFunc, type AutolangType, type LibraryConfig };