From 8cac89b9c1243dbf3115f778b19bebc620fa603d Mon Sep 17 00:00:00 2001 From: Mitch Russell <34431383+mjoerussell@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:43:08 -0600 Subject: [PATCH] Generate Typescript documentation from wit files (#1157) This PR uses the `jco types` command to generate Typescript definitions for the wasm crates instead of `jco transpile`. The reason is that `jco transpile` generates ts definitions by decoding WASM component binaries, whereas `jco types` parses .wit files directly and uses that information. This means that the `Resolve` instance created during `types` has access to the type documentation info, and the one created during `transpile` does not. I've modified `infra check npm` with a new step which calls `jco types` and handles the resulting .d.ts files. When calling `jco transpile` we're now passing the option `--no-typescript` to avoid generating conflicting typescript outputs. These changes depend on https://github.com/NomicFoundation/jco/pull/1, which augments the `types` command to accept the same configuration file that we pass to `transpile`. Without this, the codegen in `types` will not be able to generate Typescript enums for Rust enums, or any other customization that we want. --- .../codegen_runtime_cargo_wasm.component.d.ts | 10 - .../nomic-foundation-slang-cst.d.ts | 274 ++++++++++++++++++ .../nomic-foundation-slang-parser.d.ts | 39 +++ .../interfaces/wasi-cli-environment.d.ts | 5 - .../generated/interfaces/wasi-cli-exit.d.ts | 6 - .../generated/interfaces/wasi-cli-stderr.d.ts | 7 - .../generated/interfaces/wasi-cli-stdin.d.ts | 7 - .../generated/interfaces/wasi-cli-stdout.d.ts | 7 - .../interfaces/wasi-clocks-wall-clock.d.ts | 7 - .../interfaces/wasi-filesystem-preopens.d.ts | 7 - .../interfaces/wasi-filesystem-types.d.ts | 172 ----------- .../generated/interfaces/wasi-io-error.d.ts | 7 - .../generated/interfaces/wasi-io-streams.d.ts | 25 -- crates/infra/cli/src/toolchains/wasm/mod.rs | 24 +- .../nomic-foundation-slang-cst.d.ts | 247 ++++++++++++++++ .../nomic-foundation-slang-parser.d.ts | 39 +++ .../interfaces/wasi-cli-environment.d.ts | 5 - .../generated/interfaces/wasi-cli-exit.d.ts | 6 - .../generated/interfaces/wasi-cli-stderr.d.ts | 7 - .../generated/interfaces/wasi-cli-stdin.d.ts | 7 - .../generated/interfaces/wasi-cli-stdout.d.ts | 7 - .../interfaces/wasi-clocks-wall-clock.d.ts | 7 - .../interfaces/wasi-filesystem-preopens.d.ts | 7 - .../interfaces/wasi-filesystem-types.d.ts | 172 ----------- .../generated/interfaces/wasi-io-error.d.ts | 7 - .../generated/interfaces/wasi-io-streams.d.ts | 25 -- .../solidity_cargo_wasm.component.d.ts | 10 - .../nomic-foundation-slang-cst.d.ts | 247 ++++++++++++++++ .../nomic-foundation-slang-parser.d.ts | 39 +++ .../interfaces/wasi-cli-environment.d.ts | 5 - .../generated/interfaces/wasi-cli-exit.d.ts | 6 - .../generated/interfaces/wasi-cli-stderr.d.ts | 7 - .../generated/interfaces/wasi-cli-stdin.d.ts | 7 - .../generated/interfaces/wasi-cli-stdout.d.ts | 7 - .../interfaces/wasi-clocks-wall-clock.d.ts | 7 - .../interfaces/wasi-filesystem-preopens.d.ts | 7 - .../interfaces/wasi-filesystem-types.d.ts | 172 ----------- .../generated/interfaces/wasi-io-error.d.ts | 7 - .../generated/interfaces/wasi-io-streams.d.ts | 25 -- .../testlang_cargo_wasm.component.d.ts | 10 - submodules/jco | 2 +- 41 files changed, 905 insertions(+), 786 deletions(-) delete mode 100644 crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-environment.d.ts delete mode 100644 crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-exit.d.ts delete mode 100644 crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-stderr.d.ts delete mode 100644 crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-stdin.d.ts delete mode 100644 crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-stdout.d.ts delete mode 100644 crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-clocks-wall-clock.d.ts delete mode 100644 crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-filesystem-preopens.d.ts delete mode 100644 crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-filesystem-types.d.ts delete mode 100644 crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-io-error.d.ts delete mode 100644 crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-io-streams.d.ts delete mode 100644 crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-environment.d.ts delete mode 100644 crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-exit.d.ts delete mode 100644 crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stderr.d.ts delete mode 100644 crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdin.d.ts delete mode 100644 crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdout.d.ts delete mode 100644 crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-clocks-wall-clock.d.ts delete mode 100644 crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-preopens.d.ts delete mode 100644 crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-types.d.ts delete mode 100644 crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-io-error.d.ts delete mode 100644 crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-io-streams.d.ts delete mode 100644 crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-environment.d.ts delete mode 100644 crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-exit.d.ts delete mode 100644 crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stderr.d.ts delete mode 100644 crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdin.d.ts delete mode 100644 crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdout.d.ts delete mode 100644 crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-clocks-wall-clock.d.ts delete mode 100644 crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-preopens.d.ts delete mode 100644 crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-types.d.ts delete mode 100644 crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-io-error.d.ts delete mode 100644 crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-io-streams.d.ts diff --git a/crates/codegen/runtime/npm/package/wasm/generated/codegen_runtime_cargo_wasm.component.d.ts b/crates/codegen/runtime/npm/package/wasm/generated/codegen_runtime_cargo_wasm.component.d.ts index 237bb59193..c7614866dd 100644 --- a/crates/codegen/runtime/npm/package/wasm/generated/codegen_runtime_cargo_wasm.component.d.ts +++ b/crates/codegen/runtime/npm/package/wasm/generated/codegen_runtime_cargo_wasm.component.d.ts @@ -1,15 +1,5 @@ // This file is generated automatically by infrastructure scripts. Please don't edit by hand. -import { WasiCliEnvironment } from "./interfaces/wasi-cli-environment.js"; -import { WasiCliExit } from "./interfaces/wasi-cli-exit.js"; -import { WasiCliStderr } from "./interfaces/wasi-cli-stderr.js"; -import { WasiCliStdin } from "./interfaces/wasi-cli-stdin.js"; -import { WasiCliStdout } from "./interfaces/wasi-cli-stdout.js"; -import { WasiClocksWallClock } from "./interfaces/wasi-clocks-wall-clock.js"; -import { WasiFilesystemPreopens } from "./interfaces/wasi-filesystem-preopens.js"; -import { WasiFilesystemTypes } from "./interfaces/wasi-filesystem-types.js"; -import { WasiIoError } from "./interfaces/wasi-io-error.js"; -import { WasiIoStreams } from "./interfaces/wasi-io-streams.js"; import { NomicFoundationSlangCst } from "./interfaces/nomic-foundation-slang-cst.js"; import { NomicFoundationSlangAst } from "./interfaces/nomic-foundation-slang-ast.js"; import { NomicFoundationSlangParser } from "./interfaces/nomic-foundation-slang-parser.js"; diff --git a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts index 0c2e59e0bb..8c5babbfdd 100644 --- a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts +++ b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts @@ -15,18 +15,55 @@ export namespace NomicFoundationSlangCst { export { Node }; export { NodeVariant }; } +/** + * Represents different kinds of nonterminal nodes in the syntax tree. + * These are nodes that can have child nodes and represent higher-level language constructs. + */ export declare enum NonterminalKind { + /** + * Generated stub. + */ Stub1 = "Stub1", + /** + * Generated stub. + */ Stub2 = "Stub2", + /** + * Generated stub. + */ Stub3 = "Stub3", } +/** + * Represents different kinds of terminal nodes in the syntax tree. + * These are leaf nodes that represent actual tokens in the source code. + */ export declare enum TerminalKind { + /** + * This terminal is created when the parser encounters an unexpected part of the input, + * and it cannot recognize it as any valid syntax in this position in the grammar. + */ Unrecognized = "Unrecognized", + /** + * This terminal is created when the parser is expecting a certain terminal, but it cannot find it. + * Adding the missing input in this position may allow the parser to produce a valid tree there. + */ Missing = "Missing", + /** + * Generated stub. + */ Stub1 = "Stub1", + /** + * Generated stub. + */ Stub2 = "Stub2", + /** + * Generated stub. + */ Stub3 = "Stub3", } +/** + * Represents the different types of relationships between nodes in the syntax tree. + */ export declare enum EdgeLabel { Item = "Item", Variant = "Variant", @@ -36,79 +73,254 @@ export declare enum EdgeLabel { RightOperand = "RightOperand", LeadingTrivia = "LeadingTrivia", TrailingTrivia = "TrailingTrivia", + /** + * Generated stub. + */ Stub1 = "Stub1", + /** + * Generated stub. + */ Stub2 = "Stub2", + /** + * Generated stub. + */ Stub3 = "Stub3", } +/** + * The super type of all nodes in a tree. + */ export type Node = NonterminalNode | TerminalNode; export enum NodeVariant { NonterminalNode = "NonterminalNode", TerminalNode = "TerminalNode", } +/** + * Represents a connection between nodes in the syntax tree. + */ export interface Edge { + /** + * Optional label describing the relationship between nodes. + */ label?: EdgeLabel; + /** + * The target node of this edge. + */ node: Node; } +/** + * Represents an error that occurred while parsing a query. + */ export interface QueryError { + /** + * The error message describing what went wrong. + */ message: string; + /** + * The line number where the error occurred. + */ line: number; + /** + * The column number where the error occurred. + */ column: number; } +/** + * Represents a match found by executing a query. + */ export interface QueryMatch { + /** + * The index of the query that produced this match. + */ queryNumber: number; + /** + * List of captured nodes and their names from the query. + */ captures: { [key: string]: Cursor[] }; } +/** + * Represents a position in the source text, with indices for different unicode encodings of the source. + */ export interface TextIndex { + /** + * Byte offset in UTF-8 encoding. + * This is useful when working with languages like Rust that use UTF-8. + */ utf8: number; + /** + * Byte offset in UTF-8 encoding. + * This is useful when working with languages like JavaScript that use UTF-16. + */ utf16: number; + /** + * Line number (0-based). + * Lines are separated by: + * + * - carriage return `\r`. + * - newline `\n`. + * - line separator `\u2028`. + * - paragraph separator `\u2029`. + */ line: number; + /** + * Column number (0-based). + * Columns are counted in [unicode scalar values](https://www.unicode.org/glossary/#unicode_scalar_value). + */ column: number; } +/** + * Represents a range in the source text. + */ export interface TextRange { + /** + * Starting (inclusive) position of the range. + */ start: TextIndex; + /** + * Ending (exclusive) position of the range. + */ end: TextIndex; } export class AncestorsIterator { [Symbol.iterator](): Iterator; + /** + * Returns the next nonterminal node in the iteration, or `undefined` if there are no more nodes. + */ next(): NonterminalNode | undefined; } export class Cursor { + /** + * Resets the cursor to its initial position. + */ reset(): void; + /** + * Marks the cursor as completed. + */ complete(): void; + /** + * Returns whether the cursor has completed its traversal. + */ isCompleted(): boolean; + /** + * Creates a copy of this cursor at its current position with the same ancestors. + * The new cursor can be moved independently without affecting the original cursor. + */ clone(): Cursor; + /** + * Creates a copy of this cursor at its current position, but without any ancestors. + * This is useful for limiting the scope of a search or query to the sub-tree only, without backtracking to parent nodes. + * The new cursor can be moved independently without affecting the original cursor. + */ spawn(): Cursor; + /** + * Returns the current node under the cursor. + */ get node(): Node; + /** + * Returns the label of the edge from the parent to the current node, if any. + */ get label(): EdgeLabel | undefined; + /** + * Returns the current text offset of the cursor. + */ get textOffset(): TextIndex; + /** + * Returns the text range covered by the current node. + */ get textRange(): TextRange; + /** + * Returns the current depth in the tree (i.e. number of ancestors). + */ get depth(): number; + /** + * Returns the list of child edges directly connected to this node. + */ children(): Edge[]; + /** + * Returns an iterator over all descendants of the current node in pre-order traversal. + */ descendants(): CursorIterator; + /** + * Returns an iterator over all the remaining nodes in the current tree, moving in pre-order traversal, until the tree is completed. + */ remainingNodes(): CursorIterator; + /** + * Returns an iterator over all ancestors of the current node, starting with the immediate parent, and moving upwards, ending with the root node. + */ ancestors(): AncestorsIterator; + /** + * Moves to the next node in pre-order traversal. + */ goToNext(): boolean; + /** + * Moves to the next node that isn't a descendant of the current node. + */ goToNextNonDescendant(): boolean; + /** + * Moves to the previous node in pre-order traversal. + */ goToPrevious(): boolean; + /** + * Moves up to the parent node. + */ goToParent(): boolean; + /** + * Moves to the first child of the current node. + */ goToFirstChild(): boolean; + /** + * Moves to the last child of the current node. + */ goToLastChild(): boolean; + /** + * Moves to the nth child of the current node. + */ goToNthChild(childNumber: number): boolean; + /** + * Moves to the next sibling node. + */ goToNextSibling(): boolean; + /** + * Moves to the previous sibling node. + */ goToPreviousSibling(): boolean; + /** + * Moves to the next terminal node. + */ goToNextTerminal(): boolean; + /** + * Moves to the next terminal node of a specific kind. + */ goToNextTerminalWithKind(kind: TerminalKind): boolean; + /** + * Moves to the next terminal node matching any of the given kinds. + */ goToNextTerminalWithKinds(kinds: TerminalKind[]): boolean; + /** + * Nonterminal navigation methods + * Moves to the next nonterminal node. + */ goToNextNonterminal(): boolean; + /** + * Moves to the next nonterminal node of a specific kind. + */ goToNextNonterminalWithKind(kind: NonterminalKind): boolean; + /** + * Moves to the next nonterminal node matching any of the given kinds. + */ goToNextNonterminalWithKinds(kinds: NonterminalKind[]): boolean; + /** + * Executes the given queries and returns an iterator over the matches. + */ query(queries: Query[]): QueryMatchIterator; } export class CursorIterator { [Symbol.iterator](): Iterator; + /** + * Returns the next edge in the iteration, or `undefined` if there are no more edges. + */ next(): Edge | undefined; } @@ -121,27 +333,66 @@ export class NonterminalNode { asTerminalNode(): undefined; isTerminalNode(): false; + /** + * Returns a unique numerical identifier of the node. + * It is only valid for the lifetime of the enclosing tree. + * It can change between multiple parses, even for the same source code input. + */ get id(): number; + /** + * Returns the kind enum of this nonterminal node. + */ get kind(): NonterminalKind; + /** + * Returns the length of the text span this node covers. + */ get textLength(): TextIndex; + /** + * Returns the list of child edges directly connected to this node. + */ children(): Edge[]; + /** + * Returns an iterator over all descendants of the current node in pre-order traversal. + */ descendants(): CursorIterator; + /** + * Converts the node and its children back to source code text. + */ unparse(): string; + /** + * Converts the node to a JSON representation for debugging. + */ toJson(): string; + /** + * Creates a cursor positioned at the given text offset within this node. + */ createCursor(textOffset: TextIndex): Cursor; } export class Query { + /** + * Parses a query string into a query object. + * Throws an error if the query syntax is invalid. + */ static parse(text: string): Query; } export class QueryMatchIterator { [Symbol.iterator](): Iterator; + /** + * Returns the next match or `undefined` if there are no more matches. + */ next(): QueryMatch | undefined; } export class TerminalKindExtensions { + /** + * Returns true if the terminal is a trivia token. i.e. whitespace, comments, etc... + */ static isTrivia(kind: TerminalKind): boolean; + /** + * Returns true if the terminal is a valid token in the language grammar. + */ static isValid(kind: TerminalKind): boolean; } @@ -154,11 +405,34 @@ export class TerminalNode { asNonterminalNode(): undefined; isNonterminalNode(): false; + /** + * Returns a unique numerical identifier of the node. + * It is only valid for the lifetime of the enclosing tree. + * It can change between multiple parses, even for the same source code input. + */ get id(): number; + /** + * Returns the kind enum of this terminal node. + */ get kind(): TerminalKind; + /** + * Returns the length of the text span this node covers. + */ get textLength(): TextIndex; + /** + * Returns the list of child edges directly connected to this node. + */ children(): Edge[]; + /** + * Returns an iterator over all descendants of this node in pre-order traversal. + */ descendants(): CursorIterator; + /** + * Converts the node back to source code text. + */ unparse(): string; + /** + * Converts the node to a JSON representation for debugging. + */ toJson(): string; } diff --git a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/nomic-foundation-slang-parser.d.ts b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/nomic-foundation-slang-parser.d.ts index dc980aec84..9d24311b88 100644 --- a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/nomic-foundation-slang-parser.d.ts +++ b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/nomic-foundation-slang-parser.d.ts @@ -15,21 +15,60 @@ import type { TextRange } from "./nomic-foundation-slang-cst.js"; export { TextRange }; export class ParseError { + /** + * Returns the text range where the error occurred in the source code. + */ get textRange(): TextRange; + /** + * Returns a human-readable message describing the parsing error. + */ get message(): string; } export class ParseOutput { + /** + * Returns the root node of the parsed syntax tree. + * Even if there are parsing errors, a partial tree will still be available. + */ get tree(): Node; + /** + * Returns a list of all parsing errors encountered. + * An empty list indicates successful parsing with no errors. + */ errors(): ParseError[]; + /** + * Returns whether the parse was completely successful with no errors. + * This is equivalent to checking if the errors list is empty. + */ isValid(): boolean; + /** + * Creates a cursor for traversing the parsed syntax tree. + * The cursor starts at the root node of the tree. + */ createTreeCursor(): Cursor; } export class Parser { + /** + * Returns the root nonterminal kind for this parser's grammar. + * This represents the starting point for parsing a complete source file. + */ static rootKind(): NonterminalKind; + /** + * Returns a list of language versions supported by this parser. + * Each version string represents a specific grammar configuration. + */ static supportedVersions(): string[]; + /** + * Creates a new parser instance for the specified language version. + */ static create(version: string): Parser; + /** + * Returns the language version this parser instance is configured for. + */ get version(): string; + /** + * Parses the input string starting from the specified nonterminal kind. + */ parse(kind: NonterminalKind, input: string): ParseOutput; } diff --git a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-environment.d.ts b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-environment.d.ts deleted file mode 100644 index 2e7e18e20c..0000000000 --- a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-environment.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliEnvironment { - export function getEnvironment(): [string, string][]; -} diff --git a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-exit.d.ts b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-exit.d.ts deleted file mode 100644 index 00e416f2a9..0000000000 --- a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-exit.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliExit { - export function exit(status: Result): void; -} -export type Result = { tag: "ok"; val: T } | { tag: "err"; val: E }; diff --git a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-stderr.d.ts b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-stderr.d.ts deleted file mode 100644 index 58b90e29bf..0000000000 --- a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-stderr.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliStderr { - export function getStderr(): OutputStream; -} -import type { OutputStream } from "./wasi-io-streams.js"; -export { OutputStream }; diff --git a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-stdin.d.ts b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-stdin.d.ts deleted file mode 100644 index e5f574f5bd..0000000000 --- a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-stdin.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliStdin { - export function getStdin(): InputStream; -} -import type { InputStream } from "./wasi-io-streams.js"; -export { InputStream }; diff --git a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-stdout.d.ts b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-stdout.d.ts deleted file mode 100644 index 49023013c5..0000000000 --- a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-cli-stdout.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliStdout { - export function getStdout(): OutputStream; -} -import type { OutputStream } from "./wasi-io-streams.js"; -export { OutputStream }; diff --git a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-clocks-wall-clock.d.ts b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-clocks-wall-clock.d.ts deleted file mode 100644 index ea190faee8..0000000000 --- a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-clocks-wall-clock.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiClocksWallClock {} -export interface Datetime { - seconds: bigint; - nanoseconds: number; -} diff --git a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-filesystem-preopens.d.ts b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-filesystem-preopens.d.ts deleted file mode 100644 index 7c94c88da2..0000000000 --- a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-filesystem-preopens.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiFilesystemPreopens { - export function getDirectories(): [Descriptor, string][]; -} -import type { Descriptor } from "./wasi-filesystem-types.js"; -export { Descriptor }; diff --git a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-filesystem-types.d.ts b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-filesystem-types.d.ts deleted file mode 100644 index 140b5f4bac..0000000000 --- a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-filesystem-types.d.ts +++ /dev/null @@ -1,172 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiFilesystemTypes { - export { Descriptor }; - export function filesystemErrorCode(err: Error): ErrorCode | undefined; -} -export type Filesize = bigint; -import type { OutputStream } from "./wasi-io-streams.js"; -export { OutputStream }; -/** - * # Variants - * - * ## `"access"` - * - * ## `"would-block"` - * - * ## `"already"` - * - * ## `"bad-descriptor"` - * - * ## `"busy"` - * - * ## `"deadlock"` - * - * ## `"quota"` - * - * ## `"exist"` - * - * ## `"file-too-large"` - * - * ## `"illegal-byte-sequence"` - * - * ## `"in-progress"` - * - * ## `"interrupted"` - * - * ## `"invalid"` - * - * ## `"io"` - * - * ## `"is-directory"` - * - * ## `"loop"` - * - * ## `"too-many-links"` - * - * ## `"message-size"` - * - * ## `"name-too-long"` - * - * ## `"no-device"` - * - * ## `"no-entry"` - * - * ## `"no-lock"` - * - * ## `"insufficient-memory"` - * - * ## `"insufficient-space"` - * - * ## `"not-directory"` - * - * ## `"not-empty"` - * - * ## `"not-recoverable"` - * - * ## `"unsupported"` - * - * ## `"no-tty"` - * - * ## `"no-such-device"` - * - * ## `"overflow"` - * - * ## `"not-permitted"` - * - * ## `"pipe"` - * - * ## `"read-only"` - * - * ## `"invalid-seek"` - * - * ## `"text-file-busy"` - * - * ## `"cross-device"` - */ -export type ErrorCode = - | "access" - | "would-block" - | "already" - | "bad-descriptor" - | "busy" - | "deadlock" - | "quota" - | "exist" - | "file-too-large" - | "illegal-byte-sequence" - | "in-progress" - | "interrupted" - | "invalid" - | "io" - | "is-directory" - | "loop" - | "too-many-links" - | "message-size" - | "name-too-long" - | "no-device" - | "no-entry" - | "no-lock" - | "insufficient-memory" - | "insufficient-space" - | "not-directory" - | "not-empty" - | "not-recoverable" - | "unsupported" - | "no-tty" - | "no-such-device" - | "overflow" - | "not-permitted" - | "pipe" - | "read-only" - | "invalid-seek" - | "text-file-busy" - | "cross-device"; -/** - * # Variants - * - * ## `"unknown"` - * - * ## `"block-device"` - * - * ## `"character-device"` - * - * ## `"directory"` - * - * ## `"fifo"` - * - * ## `"symbolic-link"` - * - * ## `"regular-file"` - * - * ## `"socket"` - */ -export type DescriptorType = - | "unknown" - | "block-device" - | "character-device" - | "directory" - | "fifo" - | "symbolic-link" - | "regular-file" - | "socket"; -export type LinkCount = bigint; -import type { Datetime } from "./wasi-clocks-wall-clock.js"; -export { Datetime }; -export interface DescriptorStat { - type: DescriptorType; - linkCount: LinkCount; - size: Filesize; - dataAccessTimestamp?: Datetime; - dataModificationTimestamp?: Datetime; - statusChangeTimestamp?: Datetime; -} -import type { Error } from "./wasi-io-streams.js"; -export { Error }; - -export class Descriptor { - writeViaStream(offset: Filesize): OutputStream; - appendViaStream(): OutputStream; - getType(): DescriptorType; - stat(): DescriptorStat; -} diff --git a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-io-error.d.ts b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-io-error.d.ts deleted file mode 100644 index f52a8b4cc5..0000000000 --- a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-io-error.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiIoError { - export { Error }; -} - -export class Error {} diff --git a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-io-streams.d.ts b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-io-streams.d.ts deleted file mode 100644 index fc56e10c39..0000000000 --- a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/wasi-io-streams.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiIoStreams { - export { OutputStream }; - export { InputStream }; -} -import type { Error } from "./wasi-io-error.js"; -export { Error }; -export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed; -export interface StreamErrorLastOperationFailed { - tag: "last-operation-failed"; - val: Error; -} -export interface StreamErrorClosed { - tag: "closed"; -} - -export class InputStream {} - -export class OutputStream { - checkWrite(): bigint; - write(contents: Uint8Array): void; - blockingWriteAndFlush(contents: Uint8Array): void; - blockingFlush(): void; -} diff --git a/crates/infra/cli/src/toolchains/wasm/mod.rs b/crates/infra/cli/src/toolchains/wasm/mod.rs index ae870af82c..9c8383d070 100644 --- a/crates/infra/cli/src/toolchains/wasm/mod.rs +++ b/crates/infra/cli/src/toolchains/wasm/mod.rs @@ -76,12 +76,11 @@ impl WasmPackage { let temp_dir_handle = tempfile::tempdir()?; let temp_dir = temp_dir_handle.path(); - { - let wasm_crate = self.wasm_crate(); - let jco_config = CargoWorkspace::locate_source_crate(wasm_crate)? - .join(self.runtime_dir()) - .join("generated/config.json"); + let wasm_crate = self.wasm_crate(); + let runtime_dir = CargoWorkspace::locate_source_crate(wasm_crate)?.join(self.runtime_dir()); + let jco_config = runtime_dir.join("generated/config.json"); + { Command::new("node") .args([ "submodules/jco/src/jco.js", @@ -92,10 +91,25 @@ impl WasmPackage { .property("--out-dir", temp_dir.unwrap_str()) .property("--base64-cutoff", "0") // disable inlining core Wasm binaries as base64 .flag("--no-namespaced-exports") // disable namespaced exports for typescript compatibility + .flag("--no-typescript") // disable generating .d.ts files - we'll do this with `jco types` below .flag("--valid-lifting-optimization") // optimize component binary validations assuming all lifted values are valid .run(); } + { + let wit_directory = runtime_dir.join("interface/generated"); + Command::new("node") + .args([ + "submodules/jco/src/jco.js", + "types", + wit_directory.unwrap_str(), + ]) + .property("--name", format!("{wasm_crate}.component")) + .property("--configuration-file", jco_config.unwrap_str()) + .property("--out-dir", temp_dir.unwrap_str()) + .run(); + } + let npm_crate = self.npm_crate(); let output_dir = CargoWorkspace::locate_source_crate(npm_crate)?.join("wasm/generated"); diff --git a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts index e68c41d8a7..c1da5bac6e 100644 --- a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts +++ b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts @@ -15,6 +15,10 @@ export namespace NomicFoundationSlangCst { export { Node }; export { NodeVariant }; } +/** + * Represents different kinds of nonterminal nodes in the syntax tree. + * These are nodes that can have child nodes and represent higher-level language constructs. + */ export declare enum NonterminalKind { AbicoderPragma = "AbicoderPragma", AdditiveExpression = "AdditiveExpression", @@ -234,8 +238,20 @@ export declare enum NonterminalKind { YulVariableDeclarationValue = "YulVariableDeclarationValue", YulVariableNames = "YulVariableNames", } +/** + * Represents different kinds of terminal nodes in the syntax tree. + * These are leaf nodes that represent actual tokens in the source code. + */ export declare enum TerminalKind { + /** + * This terminal is created when the parser encounters an unexpected part of the input, + * and it cannot recognize it as any valid syntax in this position in the grammar. + */ Unrecognized = "Unrecognized", + /** + * This terminal is created when the parser is expecting a certain terminal, but it cannot find it. + * Adding the missing input in this position may allow the parser to produce a valid tree there. + */ Missing = "Missing", AbicoderKeyword = "AbicoderKeyword", AbstractKeyword = "AbstractKeyword", @@ -613,6 +629,9 @@ export declare enum TerminalKind { YulXorKeyword = "YulXorKeyword", YulYearsKeyword = "YulYearsKeyword", } +/** + * Represents the different types of relationships between nodes in the syntax tree. + */ export declare enum EdgeLabel { Item = "Item", Variant = "Variant", @@ -747,75 +766,241 @@ export declare enum EdgeLabel { Version = "Version", WhileKeyword = "WhileKeyword", } +/** + * The super type of all nodes in a tree. + */ export type Node = NonterminalNode | TerminalNode; export enum NodeVariant { NonterminalNode = "NonterminalNode", TerminalNode = "TerminalNode", } +/** + * Represents a connection between nodes in the syntax tree. + */ export interface Edge { + /** + * Optional label describing the relationship between nodes. + */ label?: EdgeLabel; + /** + * The target node of this edge. + */ node: Node; } +/** + * Represents an error that occurred while parsing a query. + */ export interface QueryError { + /** + * The error message describing what went wrong. + */ message: string; + /** + * The line number where the error occurred. + */ line: number; + /** + * The column number where the error occurred. + */ column: number; } +/** + * Represents a match found by executing a query. + */ export interface QueryMatch { + /** + * The index of the query that produced this match. + */ queryNumber: number; + /** + * List of captured nodes and their names from the query. + */ captures: { [key: string]: Cursor[] }; } +/** + * Represents a position in the source text, with indices for different unicode encodings of the source. + */ export interface TextIndex { + /** + * Byte offset in UTF-8 encoding. + * This is useful when working with languages like Rust that use UTF-8. + */ utf8: number; + /** + * Byte offset in UTF-8 encoding. + * This is useful when working with languages like JavaScript that use UTF-16. + */ utf16: number; + /** + * Line number (0-based). + * Lines are separated by: + * + * - carriage return `\r`. + * - newline `\n`. + * - line separator `\u2028`. + * - paragraph separator `\u2029`. + */ line: number; + /** + * Column number (0-based). + * Columns are counted in [unicode scalar values](https://www.unicode.org/glossary/#unicode_scalar_value). + */ column: number; } +/** + * Represents a range in the source text. + */ export interface TextRange { + /** + * Starting (inclusive) position of the range. + */ start: TextIndex; + /** + * Ending (exclusive) position of the range. + */ end: TextIndex; } export class AncestorsIterator { [Symbol.iterator](): Iterator; + /** + * Returns the next nonterminal node in the iteration, or `undefined` if there are no more nodes. + */ next(): NonterminalNode | undefined; } export class Cursor { + /** + * Resets the cursor to its initial position. + */ reset(): void; + /** + * Marks the cursor as completed. + */ complete(): void; + /** + * Returns whether the cursor has completed its traversal. + */ isCompleted(): boolean; + /** + * Creates a copy of this cursor at its current position with the same ancestors. + * The new cursor can be moved independently without affecting the original cursor. + */ clone(): Cursor; + /** + * Creates a copy of this cursor at its current position, but without any ancestors. + * This is useful for limiting the scope of a search or query to the sub-tree only, without backtracking to parent nodes. + * The new cursor can be moved independently without affecting the original cursor. + */ spawn(): Cursor; + /** + * Returns the current node under the cursor. + */ get node(): Node; + /** + * Returns the label of the edge from the parent to the current node, if any. + */ get label(): EdgeLabel | undefined; + /** + * Returns the current text offset of the cursor. + */ get textOffset(): TextIndex; + /** + * Returns the text range covered by the current node. + */ get textRange(): TextRange; + /** + * Returns the current depth in the tree (i.e. number of ancestors). + */ get depth(): number; + /** + * Returns the list of child edges directly connected to this node. + */ children(): Edge[]; + /** + * Returns an iterator over all descendants of the current node in pre-order traversal. + */ descendants(): CursorIterator; + /** + * Returns an iterator over all the remaining nodes in the current tree, moving in pre-order traversal, until the tree is completed. + */ remainingNodes(): CursorIterator; + /** + * Returns an iterator over all ancestors of the current node, starting with the immediate parent, and moving upwards, ending with the root node. + */ ancestors(): AncestorsIterator; + /** + * Moves to the next node in pre-order traversal. + */ goToNext(): boolean; + /** + * Moves to the next node that isn't a descendant of the current node. + */ goToNextNonDescendant(): boolean; + /** + * Moves to the previous node in pre-order traversal. + */ goToPrevious(): boolean; + /** + * Moves up to the parent node. + */ goToParent(): boolean; + /** + * Moves to the first child of the current node. + */ goToFirstChild(): boolean; + /** + * Moves to the last child of the current node. + */ goToLastChild(): boolean; + /** + * Moves to the nth child of the current node. + */ goToNthChild(childNumber: number): boolean; + /** + * Moves to the next sibling node. + */ goToNextSibling(): boolean; + /** + * Moves to the previous sibling node. + */ goToPreviousSibling(): boolean; + /** + * Moves to the next terminal node. + */ goToNextTerminal(): boolean; + /** + * Moves to the next terminal node of a specific kind. + */ goToNextTerminalWithKind(kind: TerminalKind): boolean; + /** + * Moves to the next terminal node matching any of the given kinds. + */ goToNextTerminalWithKinds(kinds: TerminalKind[]): boolean; + /** + * Nonterminal navigation methods + * Moves to the next nonterminal node. + */ goToNextNonterminal(): boolean; + /** + * Moves to the next nonterminal node of a specific kind. + */ goToNextNonterminalWithKind(kind: NonterminalKind): boolean; + /** + * Moves to the next nonterminal node matching any of the given kinds. + */ goToNextNonterminalWithKinds(kinds: NonterminalKind[]): boolean; + /** + * Executes the given queries and returns an iterator over the matches. + */ query(queries: Query[]): QueryMatchIterator; } export class CursorIterator { [Symbol.iterator](): Iterator; + /** + * Returns the next edge in the iteration, or `undefined` if there are no more edges. + */ next(): Edge | undefined; } @@ -828,27 +1013,66 @@ export class NonterminalNode { asTerminalNode(): undefined; isTerminalNode(): false; + /** + * Returns a unique numerical identifier of the node. + * It is only valid for the lifetime of the enclosing tree. + * It can change between multiple parses, even for the same source code input. + */ get id(): number; + /** + * Returns the kind enum of this nonterminal node. + */ get kind(): NonterminalKind; + /** + * Returns the length of the text span this node covers. + */ get textLength(): TextIndex; + /** + * Returns the list of child edges directly connected to this node. + */ children(): Edge[]; + /** + * Returns an iterator over all descendants of the current node in pre-order traversal. + */ descendants(): CursorIterator; + /** + * Converts the node and its children back to source code text. + */ unparse(): string; + /** + * Converts the node to a JSON representation for debugging. + */ toJson(): string; + /** + * Creates a cursor positioned at the given text offset within this node. + */ createCursor(textOffset: TextIndex): Cursor; } export class Query { + /** + * Parses a query string into a query object. + * Throws an error if the query syntax is invalid. + */ static parse(text: string): Query; } export class QueryMatchIterator { [Symbol.iterator](): Iterator; + /** + * Returns the next match or `undefined` if there are no more matches. + */ next(): QueryMatch | undefined; } export class TerminalKindExtensions { + /** + * Returns true if the terminal is a trivia token. i.e. whitespace, comments, etc... + */ static isTrivia(kind: TerminalKind): boolean; + /** + * Returns true if the terminal is a valid token in the language grammar. + */ static isValid(kind: TerminalKind): boolean; } @@ -861,11 +1085,34 @@ export class TerminalNode { asNonterminalNode(): undefined; isNonterminalNode(): false; + /** + * Returns a unique numerical identifier of the node. + * It is only valid for the lifetime of the enclosing tree. + * It can change between multiple parses, even for the same source code input. + */ get id(): number; + /** + * Returns the kind enum of this terminal node. + */ get kind(): TerminalKind; + /** + * Returns the length of the text span this node covers. + */ get textLength(): TextIndex; + /** + * Returns the list of child edges directly connected to this node. + */ children(): Edge[]; + /** + * Returns an iterator over all descendants of this node in pre-order traversal. + */ descendants(): CursorIterator; + /** + * Converts the node back to source code text. + */ unparse(): string; + /** + * Converts the node to a JSON representation for debugging. + */ toJson(): string; } diff --git a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-parser.d.ts b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-parser.d.ts index dc980aec84..9d24311b88 100644 --- a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-parser.d.ts +++ b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-parser.d.ts @@ -15,21 +15,60 @@ import type { TextRange } from "./nomic-foundation-slang-cst.js"; export { TextRange }; export class ParseError { + /** + * Returns the text range where the error occurred in the source code. + */ get textRange(): TextRange; + /** + * Returns a human-readable message describing the parsing error. + */ get message(): string; } export class ParseOutput { + /** + * Returns the root node of the parsed syntax tree. + * Even if there are parsing errors, a partial tree will still be available. + */ get tree(): Node; + /** + * Returns a list of all parsing errors encountered. + * An empty list indicates successful parsing with no errors. + */ errors(): ParseError[]; + /** + * Returns whether the parse was completely successful with no errors. + * This is equivalent to checking if the errors list is empty. + */ isValid(): boolean; + /** + * Creates a cursor for traversing the parsed syntax tree. + * The cursor starts at the root node of the tree. + */ createTreeCursor(): Cursor; } export class Parser { + /** + * Returns the root nonterminal kind for this parser's grammar. + * This represents the starting point for parsing a complete source file. + */ static rootKind(): NonterminalKind; + /** + * Returns a list of language versions supported by this parser. + * Each version string represents a specific grammar configuration. + */ static supportedVersions(): string[]; + /** + * Creates a new parser instance for the specified language version. + */ static create(version: string): Parser; + /** + * Returns the language version this parser instance is configured for. + */ get version(): string; + /** + * Parses the input string starting from the specified nonterminal kind. + */ parse(kind: NonterminalKind, input: string): ParseOutput; } diff --git a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-environment.d.ts b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-environment.d.ts deleted file mode 100644 index 2e7e18e20c..0000000000 --- a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-environment.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliEnvironment { - export function getEnvironment(): [string, string][]; -} diff --git a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-exit.d.ts b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-exit.d.ts deleted file mode 100644 index 00e416f2a9..0000000000 --- a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-exit.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliExit { - export function exit(status: Result): void; -} -export type Result = { tag: "ok"; val: T } | { tag: "err"; val: E }; diff --git a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stderr.d.ts b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stderr.d.ts deleted file mode 100644 index 58b90e29bf..0000000000 --- a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stderr.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliStderr { - export function getStderr(): OutputStream; -} -import type { OutputStream } from "./wasi-io-streams.js"; -export { OutputStream }; diff --git a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdin.d.ts b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdin.d.ts deleted file mode 100644 index e5f574f5bd..0000000000 --- a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdin.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliStdin { - export function getStdin(): InputStream; -} -import type { InputStream } from "./wasi-io-streams.js"; -export { InputStream }; diff --git a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdout.d.ts b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdout.d.ts deleted file mode 100644 index 49023013c5..0000000000 --- a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdout.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliStdout { - export function getStdout(): OutputStream; -} -import type { OutputStream } from "./wasi-io-streams.js"; -export { OutputStream }; diff --git a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-clocks-wall-clock.d.ts b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-clocks-wall-clock.d.ts deleted file mode 100644 index ea190faee8..0000000000 --- a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-clocks-wall-clock.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiClocksWallClock {} -export interface Datetime { - seconds: bigint; - nanoseconds: number; -} diff --git a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-preopens.d.ts b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-preopens.d.ts deleted file mode 100644 index 7c94c88da2..0000000000 --- a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-preopens.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiFilesystemPreopens { - export function getDirectories(): [Descriptor, string][]; -} -import type { Descriptor } from "./wasi-filesystem-types.js"; -export { Descriptor }; diff --git a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-types.d.ts b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-types.d.ts deleted file mode 100644 index 140b5f4bac..0000000000 --- a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-types.d.ts +++ /dev/null @@ -1,172 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiFilesystemTypes { - export { Descriptor }; - export function filesystemErrorCode(err: Error): ErrorCode | undefined; -} -export type Filesize = bigint; -import type { OutputStream } from "./wasi-io-streams.js"; -export { OutputStream }; -/** - * # Variants - * - * ## `"access"` - * - * ## `"would-block"` - * - * ## `"already"` - * - * ## `"bad-descriptor"` - * - * ## `"busy"` - * - * ## `"deadlock"` - * - * ## `"quota"` - * - * ## `"exist"` - * - * ## `"file-too-large"` - * - * ## `"illegal-byte-sequence"` - * - * ## `"in-progress"` - * - * ## `"interrupted"` - * - * ## `"invalid"` - * - * ## `"io"` - * - * ## `"is-directory"` - * - * ## `"loop"` - * - * ## `"too-many-links"` - * - * ## `"message-size"` - * - * ## `"name-too-long"` - * - * ## `"no-device"` - * - * ## `"no-entry"` - * - * ## `"no-lock"` - * - * ## `"insufficient-memory"` - * - * ## `"insufficient-space"` - * - * ## `"not-directory"` - * - * ## `"not-empty"` - * - * ## `"not-recoverable"` - * - * ## `"unsupported"` - * - * ## `"no-tty"` - * - * ## `"no-such-device"` - * - * ## `"overflow"` - * - * ## `"not-permitted"` - * - * ## `"pipe"` - * - * ## `"read-only"` - * - * ## `"invalid-seek"` - * - * ## `"text-file-busy"` - * - * ## `"cross-device"` - */ -export type ErrorCode = - | "access" - | "would-block" - | "already" - | "bad-descriptor" - | "busy" - | "deadlock" - | "quota" - | "exist" - | "file-too-large" - | "illegal-byte-sequence" - | "in-progress" - | "interrupted" - | "invalid" - | "io" - | "is-directory" - | "loop" - | "too-many-links" - | "message-size" - | "name-too-long" - | "no-device" - | "no-entry" - | "no-lock" - | "insufficient-memory" - | "insufficient-space" - | "not-directory" - | "not-empty" - | "not-recoverable" - | "unsupported" - | "no-tty" - | "no-such-device" - | "overflow" - | "not-permitted" - | "pipe" - | "read-only" - | "invalid-seek" - | "text-file-busy" - | "cross-device"; -/** - * # Variants - * - * ## `"unknown"` - * - * ## `"block-device"` - * - * ## `"character-device"` - * - * ## `"directory"` - * - * ## `"fifo"` - * - * ## `"symbolic-link"` - * - * ## `"regular-file"` - * - * ## `"socket"` - */ -export type DescriptorType = - | "unknown" - | "block-device" - | "character-device" - | "directory" - | "fifo" - | "symbolic-link" - | "regular-file" - | "socket"; -export type LinkCount = bigint; -import type { Datetime } from "./wasi-clocks-wall-clock.js"; -export { Datetime }; -export interface DescriptorStat { - type: DescriptorType; - linkCount: LinkCount; - size: Filesize; - dataAccessTimestamp?: Datetime; - dataModificationTimestamp?: Datetime; - statusChangeTimestamp?: Datetime; -} -import type { Error } from "./wasi-io-streams.js"; -export { Error }; - -export class Descriptor { - writeViaStream(offset: Filesize): OutputStream; - appendViaStream(): OutputStream; - getType(): DescriptorType; - stat(): DescriptorStat; -} diff --git a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-io-error.d.ts b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-io-error.d.ts deleted file mode 100644 index f52a8b4cc5..0000000000 --- a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-io-error.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiIoError { - export { Error }; -} - -export class Error {} diff --git a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-io-streams.d.ts b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-io-streams.d.ts deleted file mode 100644 index fc56e10c39..0000000000 --- a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/wasi-io-streams.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiIoStreams { - export { OutputStream }; - export { InputStream }; -} -import type { Error } from "./wasi-io-error.js"; -export { Error }; -export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed; -export interface StreamErrorLastOperationFailed { - tag: "last-operation-failed"; - val: Error; -} -export interface StreamErrorClosed { - tag: "closed"; -} - -export class InputStream {} - -export class OutputStream { - checkWrite(): bigint; - write(contents: Uint8Array): void; - blockingWriteAndFlush(contents: Uint8Array): void; - blockingFlush(): void; -} diff --git a/crates/solidity/outputs/npm/package/wasm/generated/solidity_cargo_wasm.component.d.ts b/crates/solidity/outputs/npm/package/wasm/generated/solidity_cargo_wasm.component.d.ts index 237bb59193..c7614866dd 100644 --- a/crates/solidity/outputs/npm/package/wasm/generated/solidity_cargo_wasm.component.d.ts +++ b/crates/solidity/outputs/npm/package/wasm/generated/solidity_cargo_wasm.component.d.ts @@ -1,15 +1,5 @@ // This file is generated automatically by infrastructure scripts. Please don't edit by hand. -import { WasiCliEnvironment } from "./interfaces/wasi-cli-environment.js"; -import { WasiCliExit } from "./interfaces/wasi-cli-exit.js"; -import { WasiCliStderr } from "./interfaces/wasi-cli-stderr.js"; -import { WasiCliStdin } from "./interfaces/wasi-cli-stdin.js"; -import { WasiCliStdout } from "./interfaces/wasi-cli-stdout.js"; -import { WasiClocksWallClock } from "./interfaces/wasi-clocks-wall-clock.js"; -import { WasiFilesystemPreopens } from "./interfaces/wasi-filesystem-preopens.js"; -import { WasiFilesystemTypes } from "./interfaces/wasi-filesystem-types.js"; -import { WasiIoError } from "./interfaces/wasi-io-error.js"; -import { WasiIoStreams } from "./interfaces/wasi-io-streams.js"; import { NomicFoundationSlangCst } from "./interfaces/nomic-foundation-slang-cst.js"; import { NomicFoundationSlangAst } from "./interfaces/nomic-foundation-slang-ast.js"; import { NomicFoundationSlangParser } from "./interfaces/nomic-foundation-slang-parser.js"; diff --git a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts index 10b1704553..b080cc140e 100644 --- a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts +++ b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts @@ -15,6 +15,10 @@ export namespace NomicFoundationSlangCst { export { Node }; export { NodeVariant }; } +/** + * Represents different kinds of nonterminal nodes in the syntax tree. + * These are nodes that can have child nodes and represent higher-level language constructs. + */ export declare enum NonterminalKind { AdditionExpression = "AdditionExpression", Expression = "Expression", @@ -30,8 +34,20 @@ export declare enum NonterminalKind { TreeNodeChild = "TreeNodeChild", TreeNodeChildren = "TreeNodeChildren", } +/** + * Represents different kinds of terminal nodes in the syntax tree. + * These are leaf nodes that represent actual tokens in the source code. + */ export declare enum TerminalKind { + /** + * This terminal is created when the parser encounters an unexpected part of the input, + * and it cannot recognize it as any valid syntax in this position in the grammar. + */ Unrecognized = "Unrecognized", + /** + * This terminal is created when the parser is expecting a certain terminal, but it cannot find it. + * Adding the missing input in this position may allow the parser to produce a valid tree there. + */ Missing = "Missing", Bang = "Bang", CloseBracket = "CloseBracket", @@ -48,6 +64,9 @@ export declare enum TerminalKind { TreeKeyword = "TreeKeyword", Whitespace = "Whitespace", } +/** + * Represents the different types of relationships between nodes in the syntax tree. + */ export declare enum EdgeLabel { Item = "Item", Variant = "Variant", @@ -68,75 +87,241 @@ export declare enum EdgeLabel { Period = "Period", Semicolon = "Semicolon", } +/** + * The super type of all nodes in a tree. + */ export type Node = NonterminalNode | TerminalNode; export enum NodeVariant { NonterminalNode = "NonterminalNode", TerminalNode = "TerminalNode", } +/** + * Represents a connection between nodes in the syntax tree. + */ export interface Edge { + /** + * Optional label describing the relationship between nodes. + */ label?: EdgeLabel; + /** + * The target node of this edge. + */ node: Node; } +/** + * Represents an error that occurred while parsing a query. + */ export interface QueryError { + /** + * The error message describing what went wrong. + */ message: string; + /** + * The line number where the error occurred. + */ line: number; + /** + * The column number where the error occurred. + */ column: number; } +/** + * Represents a match found by executing a query. + */ export interface QueryMatch { + /** + * The index of the query that produced this match. + */ queryNumber: number; + /** + * List of captured nodes and their names from the query. + */ captures: { [key: string]: Cursor[] }; } +/** + * Represents a position in the source text, with indices for different unicode encodings of the source. + */ export interface TextIndex { + /** + * Byte offset in UTF-8 encoding. + * This is useful when working with languages like Rust that use UTF-8. + */ utf8: number; + /** + * Byte offset in UTF-8 encoding. + * This is useful when working with languages like JavaScript that use UTF-16. + */ utf16: number; + /** + * Line number (0-based). + * Lines are separated by: + * + * - carriage return `\r`. + * - newline `\n`. + * - line separator `\u2028`. + * - paragraph separator `\u2029`. + */ line: number; + /** + * Column number (0-based). + * Columns are counted in [unicode scalar values](https://www.unicode.org/glossary/#unicode_scalar_value). + */ column: number; } +/** + * Represents a range in the source text. + */ export interface TextRange { + /** + * Starting (inclusive) position of the range. + */ start: TextIndex; + /** + * Ending (exclusive) position of the range. + */ end: TextIndex; } export class AncestorsIterator { [Symbol.iterator](): Iterator; + /** + * Returns the next nonterminal node in the iteration, or `undefined` if there are no more nodes. + */ next(): NonterminalNode | undefined; } export class Cursor { + /** + * Resets the cursor to its initial position. + */ reset(): void; + /** + * Marks the cursor as completed. + */ complete(): void; + /** + * Returns whether the cursor has completed its traversal. + */ isCompleted(): boolean; + /** + * Creates a copy of this cursor at its current position with the same ancestors. + * The new cursor can be moved independently without affecting the original cursor. + */ clone(): Cursor; + /** + * Creates a copy of this cursor at its current position, but without any ancestors. + * This is useful for limiting the scope of a search or query to the sub-tree only, without backtracking to parent nodes. + * The new cursor can be moved independently without affecting the original cursor. + */ spawn(): Cursor; + /** + * Returns the current node under the cursor. + */ get node(): Node; + /** + * Returns the label of the edge from the parent to the current node, if any. + */ get label(): EdgeLabel | undefined; + /** + * Returns the current text offset of the cursor. + */ get textOffset(): TextIndex; + /** + * Returns the text range covered by the current node. + */ get textRange(): TextRange; + /** + * Returns the current depth in the tree (i.e. number of ancestors). + */ get depth(): number; + /** + * Returns the list of child edges directly connected to this node. + */ children(): Edge[]; + /** + * Returns an iterator over all descendants of the current node in pre-order traversal. + */ descendants(): CursorIterator; + /** + * Returns an iterator over all the remaining nodes in the current tree, moving in pre-order traversal, until the tree is completed. + */ remainingNodes(): CursorIterator; + /** + * Returns an iterator over all ancestors of the current node, starting with the immediate parent, and moving upwards, ending with the root node. + */ ancestors(): AncestorsIterator; + /** + * Moves to the next node in pre-order traversal. + */ goToNext(): boolean; + /** + * Moves to the next node that isn't a descendant of the current node. + */ goToNextNonDescendant(): boolean; + /** + * Moves to the previous node in pre-order traversal. + */ goToPrevious(): boolean; + /** + * Moves up to the parent node. + */ goToParent(): boolean; + /** + * Moves to the first child of the current node. + */ goToFirstChild(): boolean; + /** + * Moves to the last child of the current node. + */ goToLastChild(): boolean; + /** + * Moves to the nth child of the current node. + */ goToNthChild(childNumber: number): boolean; + /** + * Moves to the next sibling node. + */ goToNextSibling(): boolean; + /** + * Moves to the previous sibling node. + */ goToPreviousSibling(): boolean; + /** + * Moves to the next terminal node. + */ goToNextTerminal(): boolean; + /** + * Moves to the next terminal node of a specific kind. + */ goToNextTerminalWithKind(kind: TerminalKind): boolean; + /** + * Moves to the next terminal node matching any of the given kinds. + */ goToNextTerminalWithKinds(kinds: TerminalKind[]): boolean; + /** + * Nonterminal navigation methods + * Moves to the next nonterminal node. + */ goToNextNonterminal(): boolean; + /** + * Moves to the next nonterminal node of a specific kind. + */ goToNextNonterminalWithKind(kind: NonterminalKind): boolean; + /** + * Moves to the next nonterminal node matching any of the given kinds. + */ goToNextNonterminalWithKinds(kinds: NonterminalKind[]): boolean; + /** + * Executes the given queries and returns an iterator over the matches. + */ query(queries: Query[]): QueryMatchIterator; } export class CursorIterator { [Symbol.iterator](): Iterator; + /** + * Returns the next edge in the iteration, or `undefined` if there are no more edges. + */ next(): Edge | undefined; } @@ -149,27 +334,66 @@ export class NonterminalNode { asTerminalNode(): undefined; isTerminalNode(): false; + /** + * Returns a unique numerical identifier of the node. + * It is only valid for the lifetime of the enclosing tree. + * It can change between multiple parses, even for the same source code input. + */ get id(): number; + /** + * Returns the kind enum of this nonterminal node. + */ get kind(): NonterminalKind; + /** + * Returns the length of the text span this node covers. + */ get textLength(): TextIndex; + /** + * Returns the list of child edges directly connected to this node. + */ children(): Edge[]; + /** + * Returns an iterator over all descendants of the current node in pre-order traversal. + */ descendants(): CursorIterator; + /** + * Converts the node and its children back to source code text. + */ unparse(): string; + /** + * Converts the node to a JSON representation for debugging. + */ toJson(): string; + /** + * Creates a cursor positioned at the given text offset within this node. + */ createCursor(textOffset: TextIndex): Cursor; } export class Query { + /** + * Parses a query string into a query object. + * Throws an error if the query syntax is invalid. + */ static parse(text: string): Query; } export class QueryMatchIterator { [Symbol.iterator](): Iterator; + /** + * Returns the next match or `undefined` if there are no more matches. + */ next(): QueryMatch | undefined; } export class TerminalKindExtensions { + /** + * Returns true if the terminal is a trivia token. i.e. whitespace, comments, etc... + */ static isTrivia(kind: TerminalKind): boolean; + /** + * Returns true if the terminal is a valid token in the language grammar. + */ static isValid(kind: TerminalKind): boolean; } @@ -182,11 +406,34 @@ export class TerminalNode { asNonterminalNode(): undefined; isNonterminalNode(): false; + /** + * Returns a unique numerical identifier of the node. + * It is only valid for the lifetime of the enclosing tree. + * It can change between multiple parses, even for the same source code input. + */ get id(): number; + /** + * Returns the kind enum of this terminal node. + */ get kind(): TerminalKind; + /** + * Returns the length of the text span this node covers. + */ get textLength(): TextIndex; + /** + * Returns the list of child edges directly connected to this node. + */ children(): Edge[]; + /** + * Returns an iterator over all descendants of this node in pre-order traversal. + */ descendants(): CursorIterator; + /** + * Converts the node back to source code text. + */ unparse(): string; + /** + * Converts the node to a JSON representation for debugging. + */ toJson(): string; } diff --git a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-parser.d.ts b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-parser.d.ts index dc980aec84..9d24311b88 100644 --- a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-parser.d.ts +++ b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-parser.d.ts @@ -15,21 +15,60 @@ import type { TextRange } from "./nomic-foundation-slang-cst.js"; export { TextRange }; export class ParseError { + /** + * Returns the text range where the error occurred in the source code. + */ get textRange(): TextRange; + /** + * Returns a human-readable message describing the parsing error. + */ get message(): string; } export class ParseOutput { + /** + * Returns the root node of the parsed syntax tree. + * Even if there are parsing errors, a partial tree will still be available. + */ get tree(): Node; + /** + * Returns a list of all parsing errors encountered. + * An empty list indicates successful parsing with no errors. + */ errors(): ParseError[]; + /** + * Returns whether the parse was completely successful with no errors. + * This is equivalent to checking if the errors list is empty. + */ isValid(): boolean; + /** + * Creates a cursor for traversing the parsed syntax tree. + * The cursor starts at the root node of the tree. + */ createTreeCursor(): Cursor; } export class Parser { + /** + * Returns the root nonterminal kind for this parser's grammar. + * This represents the starting point for parsing a complete source file. + */ static rootKind(): NonterminalKind; + /** + * Returns a list of language versions supported by this parser. + * Each version string represents a specific grammar configuration. + */ static supportedVersions(): string[]; + /** + * Creates a new parser instance for the specified language version. + */ static create(version: string): Parser; + /** + * Returns the language version this parser instance is configured for. + */ get version(): string; + /** + * Parses the input string starting from the specified nonterminal kind. + */ parse(kind: NonterminalKind, input: string): ParseOutput; } diff --git a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-environment.d.ts b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-environment.d.ts deleted file mode 100644 index 2e7e18e20c..0000000000 --- a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-environment.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliEnvironment { - export function getEnvironment(): [string, string][]; -} diff --git a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-exit.d.ts b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-exit.d.ts deleted file mode 100644 index 00e416f2a9..0000000000 --- a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-exit.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliExit { - export function exit(status: Result): void; -} -export type Result = { tag: "ok"; val: T } | { tag: "err"; val: E }; diff --git a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stderr.d.ts b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stderr.d.ts deleted file mode 100644 index 58b90e29bf..0000000000 --- a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stderr.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliStderr { - export function getStderr(): OutputStream; -} -import type { OutputStream } from "./wasi-io-streams.js"; -export { OutputStream }; diff --git a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdin.d.ts b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdin.d.ts deleted file mode 100644 index e5f574f5bd..0000000000 --- a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdin.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliStdin { - export function getStdin(): InputStream; -} -import type { InputStream } from "./wasi-io-streams.js"; -export { InputStream }; diff --git a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdout.d.ts b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdout.d.ts deleted file mode 100644 index 49023013c5..0000000000 --- a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-cli-stdout.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiCliStdout { - export function getStdout(): OutputStream; -} -import type { OutputStream } from "./wasi-io-streams.js"; -export { OutputStream }; diff --git a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-clocks-wall-clock.d.ts b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-clocks-wall-clock.d.ts deleted file mode 100644 index ea190faee8..0000000000 --- a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-clocks-wall-clock.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiClocksWallClock {} -export interface Datetime { - seconds: bigint; - nanoseconds: number; -} diff --git a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-preopens.d.ts b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-preopens.d.ts deleted file mode 100644 index 7c94c88da2..0000000000 --- a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-preopens.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiFilesystemPreopens { - export function getDirectories(): [Descriptor, string][]; -} -import type { Descriptor } from "./wasi-filesystem-types.js"; -export { Descriptor }; diff --git a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-types.d.ts b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-types.d.ts deleted file mode 100644 index 140b5f4bac..0000000000 --- a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-filesystem-types.d.ts +++ /dev/null @@ -1,172 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiFilesystemTypes { - export { Descriptor }; - export function filesystemErrorCode(err: Error): ErrorCode | undefined; -} -export type Filesize = bigint; -import type { OutputStream } from "./wasi-io-streams.js"; -export { OutputStream }; -/** - * # Variants - * - * ## `"access"` - * - * ## `"would-block"` - * - * ## `"already"` - * - * ## `"bad-descriptor"` - * - * ## `"busy"` - * - * ## `"deadlock"` - * - * ## `"quota"` - * - * ## `"exist"` - * - * ## `"file-too-large"` - * - * ## `"illegal-byte-sequence"` - * - * ## `"in-progress"` - * - * ## `"interrupted"` - * - * ## `"invalid"` - * - * ## `"io"` - * - * ## `"is-directory"` - * - * ## `"loop"` - * - * ## `"too-many-links"` - * - * ## `"message-size"` - * - * ## `"name-too-long"` - * - * ## `"no-device"` - * - * ## `"no-entry"` - * - * ## `"no-lock"` - * - * ## `"insufficient-memory"` - * - * ## `"insufficient-space"` - * - * ## `"not-directory"` - * - * ## `"not-empty"` - * - * ## `"not-recoverable"` - * - * ## `"unsupported"` - * - * ## `"no-tty"` - * - * ## `"no-such-device"` - * - * ## `"overflow"` - * - * ## `"not-permitted"` - * - * ## `"pipe"` - * - * ## `"read-only"` - * - * ## `"invalid-seek"` - * - * ## `"text-file-busy"` - * - * ## `"cross-device"` - */ -export type ErrorCode = - | "access" - | "would-block" - | "already" - | "bad-descriptor" - | "busy" - | "deadlock" - | "quota" - | "exist" - | "file-too-large" - | "illegal-byte-sequence" - | "in-progress" - | "interrupted" - | "invalid" - | "io" - | "is-directory" - | "loop" - | "too-many-links" - | "message-size" - | "name-too-long" - | "no-device" - | "no-entry" - | "no-lock" - | "insufficient-memory" - | "insufficient-space" - | "not-directory" - | "not-empty" - | "not-recoverable" - | "unsupported" - | "no-tty" - | "no-such-device" - | "overflow" - | "not-permitted" - | "pipe" - | "read-only" - | "invalid-seek" - | "text-file-busy" - | "cross-device"; -/** - * # Variants - * - * ## `"unknown"` - * - * ## `"block-device"` - * - * ## `"character-device"` - * - * ## `"directory"` - * - * ## `"fifo"` - * - * ## `"symbolic-link"` - * - * ## `"regular-file"` - * - * ## `"socket"` - */ -export type DescriptorType = - | "unknown" - | "block-device" - | "character-device" - | "directory" - | "fifo" - | "symbolic-link" - | "regular-file" - | "socket"; -export type LinkCount = bigint; -import type { Datetime } from "./wasi-clocks-wall-clock.js"; -export { Datetime }; -export interface DescriptorStat { - type: DescriptorType; - linkCount: LinkCount; - size: Filesize; - dataAccessTimestamp?: Datetime; - dataModificationTimestamp?: Datetime; - statusChangeTimestamp?: Datetime; -} -import type { Error } from "./wasi-io-streams.js"; -export { Error }; - -export class Descriptor { - writeViaStream(offset: Filesize): OutputStream; - appendViaStream(): OutputStream; - getType(): DescriptorType; - stat(): DescriptorStat; -} diff --git a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-io-error.d.ts b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-io-error.d.ts deleted file mode 100644 index f52a8b4cc5..0000000000 --- a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-io-error.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiIoError { - export { Error }; -} - -export class Error {} diff --git a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-io-streams.d.ts b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-io-streams.d.ts deleted file mode 100644 index fc56e10c39..0000000000 --- a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/wasi-io-streams.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -export namespace WasiIoStreams { - export { OutputStream }; - export { InputStream }; -} -import type { Error } from "./wasi-io-error.js"; -export { Error }; -export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed; -export interface StreamErrorLastOperationFailed { - tag: "last-operation-failed"; - val: Error; -} -export interface StreamErrorClosed { - tag: "closed"; -} - -export class InputStream {} - -export class OutputStream { - checkWrite(): bigint; - write(contents: Uint8Array): void; - blockingWriteAndFlush(contents: Uint8Array): void; - blockingFlush(): void; -} diff --git a/crates/testlang/outputs/npm/package/wasm/generated/testlang_cargo_wasm.component.d.ts b/crates/testlang/outputs/npm/package/wasm/generated/testlang_cargo_wasm.component.d.ts index 237bb59193..c7614866dd 100644 --- a/crates/testlang/outputs/npm/package/wasm/generated/testlang_cargo_wasm.component.d.ts +++ b/crates/testlang/outputs/npm/package/wasm/generated/testlang_cargo_wasm.component.d.ts @@ -1,15 +1,5 @@ // This file is generated automatically by infrastructure scripts. Please don't edit by hand. -import { WasiCliEnvironment } from "./interfaces/wasi-cli-environment.js"; -import { WasiCliExit } from "./interfaces/wasi-cli-exit.js"; -import { WasiCliStderr } from "./interfaces/wasi-cli-stderr.js"; -import { WasiCliStdin } from "./interfaces/wasi-cli-stdin.js"; -import { WasiCliStdout } from "./interfaces/wasi-cli-stdout.js"; -import { WasiClocksWallClock } from "./interfaces/wasi-clocks-wall-clock.js"; -import { WasiFilesystemPreopens } from "./interfaces/wasi-filesystem-preopens.js"; -import { WasiFilesystemTypes } from "./interfaces/wasi-filesystem-types.js"; -import { WasiIoError } from "./interfaces/wasi-io-error.js"; -import { WasiIoStreams } from "./interfaces/wasi-io-streams.js"; import { NomicFoundationSlangCst } from "./interfaces/nomic-foundation-slang-cst.js"; import { NomicFoundationSlangAst } from "./interfaces/nomic-foundation-slang-ast.js"; import { NomicFoundationSlangParser } from "./interfaces/nomic-foundation-slang-parser.js"; diff --git a/submodules/jco b/submodules/jco index 6b47533932..a951a946df 160000 --- a/submodules/jco +++ b/submodules/jco @@ -1 +1 @@ -Subproject commit 6b47533932834d86b470e0a46cf1d6305238e4dd +Subproject commit a951a946df8a2e4a9db3d12d210b925a93d7ccae