Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v23.10.0
v24.9.0
36 changes: 18 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- WIP: Allow running the `make` command in the browser ([#94](https://github.com/guida-lang/compiler/issues/94))
- Initial REPL tests for basic arithmetic evaluation
- New `test` command ([#98](https://github.com/guida-lang/compiler/issues/98))
- Add `elm-explorations/test` dependency as part of `init` ([#65](https://github.com/guida-lang/compiler/issues/65))
- Extend record referred by another record’s field ([#79](https://github.com/guida-lang/compiler/issues/79))
- Add a `CONTRIBUTING.md` file ([#103](https://github.com/guida-lang/compiler/issues/103))
- `guida format` command ([#100](https://github.com/guida-lang/compiler/issues/100))
- Numeric separators ([#109](https://github.com/guida-lang/compiler/issues/109))
- Binary literals support ([#2248](https://github.com/elm/compiler/issues/2248))
- WIP: Allow running the `make` command in the browser ([#94](https://github.com/guida-lang/compiler/issues/94)).
- Initial REPL tests for basic arithmetic evaluation.
- New `test` command ([#98](https://github.com/guida-lang/compiler/issues/98)).
- Add `elm-explorations/test` dependency as part of `init` ([#65](https://github.com/guida-lang/compiler/issues/65)).
- Extend record referred by another record’s field ([#79](https://github.com/guida-lang/compiler/issues/79)).
- Add a `CONTRIBUTING.md` file ([#103](https://github.com/guida-lang/compiler/issues/103)).
- `guida format` command ([#100](https://github.com/guida-lang/compiler/issues/100)).
- Numeric separators ([#109](https://github.com/guida-lang/compiler/issues/109)).
- Binary literals support ([#2248](https://github.com/elm/compiler/issues/2248)).
- Bool type support in WebGL shader interface ([#2120](https://github.com/elm/compiler/issues/2120)).

### Fixed

- Correct reporting of multiple errors ([#99](https://github.com/guida-lang/compiler/issues/99))
- Replaced infinite looping `Crash.crash` with log and exit ([#120](https://github.com/guida-lang/compiler/issues/120))
- Correct reporting of multiple errors ([#99](https://github.com/guida-lang/compiler/issues/99)).
- Replaced infinite looping `Crash.crash` with log and exit ([#120](https://github.com/guida-lang/compiler/issues/120)).

### Changed

- Refactored project structure to support both Node and Browser environments
- Refactoring of `Task` aliases for a more unified approach across the codebase ([#108](https://github.com/guida-lang/compiler/issues/108))
- Refactored project structure to support both Node and Browser environments.
- Refactoring of `Task` aliases for a more unified approach across the codebase ([#108](https://github.com/guida-lang/compiler/issues/108)).

---

Expand All @@ -37,17 +37,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Initial stable release.
- Allow tuples with 3+ elements ([#75](https://github.com/guida-lang/compiler/issues/75).
- Allow tuples with 3+ elements ([#75](https://github.com/guida-lang/compiler/issues/75)).
- Support for `GUIDA_REGISTRY` environment variable.
- New `--yes` flag for `init` command ([#80](https://github.com/guida-lang/compiler/issues/80)).
* Support modifying records via qualified names ([#78](https://github.com/guida-lang/compiler/issues/78)).
- New `--package` flag for `init` command ([#43](https://github.com/guida-lang/compiler/issues/43)).
- New `--test` flag for `install` command ([#64](https://github.com/guida-lang/compiler/issues/64)).
- `uninstall` command ([#60](https://github.com/guida-lang/compiler/issues/60).
- Source maps support ([#63](https://github.com/guida-lang/compiler/issues/63).
- Guida-specific syntax for underscore wildcard variables ([#59](https://github.com/guida-lang/compiler/issues/59).
- `uninstall` command ([#60](https://github.com/guida-lang/compiler/issues/60)).
- Source maps support ([#63](https://github.com/guida-lang/compiler/issues/63)).
- Guida-specific syntax for underscore wildcard variables ([#59](https://github.com/guida-lang/compiler/issues/59)).
- Format command (`guida format`) ([#58](https://github.com/guida-lang/compiler/issues/58), fixes [#42](https://github.com/guida-lang/compiler/issues/42)).
- Self-hosted environment ([#9](https://github.com/guida-lang/compiler/issues/9)
- Self-hosted environment ([#9](https://github.com/guida-lang/compiler/issues/9)).
- `--optimize` flag for `build` command ([#36](https://github.com/guida-lang/compiler/issues/36)).

### Changed
Expand Down
49 changes: 40 additions & 9 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
export interface GuidaConfig {
// XMLHttpRequest constructor for making HTTP requests.
// @ts-ignore
XMLHttpRequest: typeof XMLHttpRequest;

// Write text or binary data to a path.
Expand All @@ -12,7 +13,7 @@ export interface GuidaConfig {
readFile(path: string): Promise<string | ArrayBuffer | Uint8Array | Buffer | { buffer: ArrayBuffer }>;

// Read a directory and return a list of files.
readDirectory(path: string): Promise<{ files: string[] }>;
readDirectory(path: string): Promise<{ files: string[] | Buffer<ArrayBufferLike>[] }>;

// Create a directory.
createDirectory(path: string): Promise<void>;
Expand Down Expand Up @@ -40,12 +41,42 @@ export interface MakeOptions {
// nature of the results coming from the embedded Elm/runner process.
export type GuidaResponse = any;

declare const _default: {
make: (config: GuidaConfig, path: string, options?: MakeOptions) => Promise<GuidaResponse>;
format: (config: GuidaConfig, content: string) => Promise<GuidaResponse>;
install: (config: GuidaConfig, pkg: string) => Promise<GuidaResponse>;
uninstall: (config: GuidaConfig, pkg: string) => Promise<GuidaResponse>;
diagnostics: (config: GuidaConfig, args: { content: string } | { path: string }) => Promise<{ errors?: any }>;
};
export type Message = string | { bold: boolean, underline: boolean, color: null | string, string: string };

export default _default;
export type Problem = {
title: string;
region: {
start: { line: number; column: number; };
end: { line: number; column: number; };
};
message: Message[];
}

export type CompileError = {
path: string;
name: string;
problems: Problem[];
}

export type DiagnosticsResult =
| null
| {
type: "content-error";
error: Problem;
}
| {
type: "compile-errors";
errors: CompileError[];
}
| {
type: "error";
path: null | string;
title: string;
message: Message[];
};

export declare const make: (config: GuidaConfig, path: string, options?: MakeOptions) => Promise<GuidaResponse>;
export declare const format: (config: GuidaConfig, content: string) => Promise<GuidaResponse>;
export declare const install: (config: GuidaConfig, pkg: string) => Promise<GuidaResponse>;
export declare const uninstall: (config: GuidaConfig, pkg: string) => Promise<GuidaResponse>;
export declare const diagnostics: (config: GuidaConfig, args: { content: string } | { path: string }) => Promise<DiagnosticsResult>;
2 changes: 1 addition & 1 deletion src/API/Format.elm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module API.Format exposing (run)

import Common.Format
import Compiler.Elm.Package as Pkg
import Compiler.Guida.Package as Pkg
import Compiler.Parse.Module as M
import Compiler.Parse.SyntaxVersion as SV

Expand Down
Loading
Loading