Skip to content

Commit

Permalink
update typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Dec 16, 2024
1 parent bc97f18 commit bd79e82
Show file tree
Hide file tree
Showing 174 changed files with 1,010 additions and 951 deletions.
588 changes: 323 additions & 265 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
"dependencies": {
"@cicada-lang/framework": "^0.2.0",
"@cicada-lang/partech": "^0.2.5",
"@xieyuheng/command-line": "^0.1.2",
"@xieyuheng/command-line": "^0.1.3",
"@xieyuheng/ty": "^0.3.1",
"picocolors": "^1.1.1",
"vitest": "^2.1.4"
"vitest": "^2.1.8"
},
"devDependencies": {
"@types/node": "^22.9.0",
"@types/node": "^22.10.2",
"@xieyuheng/test-runner": "^0.2.10",
"prettier": "^3.3.3",
"prettier": "^3.4.2",
"prettier-plugin-organize-imports": "^4.1.0",
"typescript": "^5.6.3"
"typescript": "^5.7.2"
}
}
4 changes: 2 additions & 2 deletions src/app/App.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AppHome } from "./AppHome.js"
import { AppReplEventHandler } from "./AppReplEventHandler.js"
import { AppHome } from "./AppHome.ts"
import { AppReplEventHandler } from "./AppReplEventHandler.ts"

export class App {
home = new AppHome()
Expand Down
10 changes: 5 additions & 5 deletions src/app/AppReplEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { ParsingError } from "@cicada-lang/partech"
import fs from "fs"
import { relative } from "node:path"
import process from "process"
import { Fetcher } from "../fetcher/Fetcher.js"
import { Report } from "../lang/errors/Report.js"
import { parseStmts } from "../lang/syntax/index.js"
import { Loader } from "../loader/index.js"
import { version } from "../version.js"
import { Fetcher } from "../fetcher/Fetcher.ts"
import { Report } from "../lang/errors/Report.ts"
import { parseStmts } from "../lang/syntax/index.ts"
import { Loader } from "../loader/index.ts"
import { version } from "../version.ts"

const fetcher = new Fetcher()

Expand Down
2 changes: 1 addition & 1 deletion src/app/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { App } from "./App.js"
import { App } from "./App.ts"

export const app = new App()
4 changes: 2 additions & 2 deletions src/command-line/commands/Default.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Command, CommandRunner } from "@xieyuheng/command-line"
import ty from "@xieyuheng/ty"
import { version } from "../../version.js"
import * as Commands from "./index.js"
import { version } from "../../version.ts"
import * as Commands from "./index.ts"

type Args = { path?: string }
type Opts = { help?: boolean; version?: boolean }
Expand Down
2 changes: 1 addition & 1 deletion src/command-line/commands/Repl.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ReadlineRepl } from "@cicada-lang/framework/lib/repls/readline-repl/index.js"
import { Command, CommandRunner } from "@xieyuheng/command-line"
import Path from "path"
import { app } from "../../app/index.js"
import { app } from "../../app/index.ts"

type Args = {}

Expand Down
8 changes: 4 additions & 4 deletions src/command-line/commands/Run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import ty from "@xieyuheng/ty"
import fs from "node:fs"
import { relative } from "node:path"
import process from "node:process"
import { Fetcher } from "../../fetcher/index.js"
import { Report } from "../../lang/errors/Report.js"
import { Loader } from "../../loader/index.js"
import { createURL } from "../../utils/createURL.js"
import { Fetcher } from "../../fetcher/index.ts"
import { Report } from "../../lang/errors/Report.ts"
import { Loader } from "../../loader/index.ts"
import { createURL } from "../../utils/createURL.ts"

type Args = { path: string }
type Opts = {}
Expand Down
6 changes: 3 additions & 3 deletions src/command-line/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from "@xieyuheng/command-line/lib/commands/index.js"
export * from "./Default.js"
export * from "./Repl.js"
export * from "./Run.js"
export * from "./Default.ts"
export * from "./Repl.ts"
export * from "./Run.ts"
2 changes: 1 addition & 1 deletion src/command-line/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CommandRunner, CommandRunners } from "@xieyuheng/command-line"
import * as Commands from "./commands/index.js"
import * as Commands from "./commands/index.ts"

export function createCommandRunner(): CommandRunner {
return new CommandRunners.CommonCommandRunner({
Expand Down
2 changes: 1 addition & 1 deletion src/fetcher/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./Fetcher.js"
export * from "./Fetcher.ts"
36 changes: 18 additions & 18 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
export * from "./fetcher/index.js"
export * from "./lang/cap/index.js"
export * from "./lang/definition/index.js"
export * from "./lang/edge/index.js"
export * from "./lang/env/index.js"
export * from "./lang/errors/index.js"
export * from "./lang/interact/index.js"
export * from "./lang/mod/index.js"
export * from "./lang/net/index.js"
export * from "./lang/node/index.js"
export * from "./lang/port/index.js"
export * from "./lang/present/index.js"
export * from "./lang/rule/index.js"
export * from "./lang/run/index.js"
export * from "./lang/syntax/index.js"
export * from "./lang/value/index.js"
export * from "./lang/word/index.js"
export * from "./loader/index.js"
export * from "./fetcher/index.ts"
export * from "./lang/cap/index.ts"
export * from "./lang/definition/index.ts"
export * from "./lang/edge/index.ts"
export * from "./lang/env/index.ts"
export * from "./lang/errors/index.ts"
export * from "./lang/interact/index.ts"
export * from "./lang/mod/index.ts"
export * from "./lang/net/index.ts"
export * from "./lang/node/index.ts"
export * from "./lang/port/index.ts"
export * from "./lang/present/index.ts"
export * from "./lang/rule/index.ts"
export * from "./lang/run/index.ts"
export * from "./lang/syntax/index.ts"
export * from "./lang/value/index.ts"
export * from "./lang/word/index.ts"
export * from "./loader/index.ts"
2 changes: 1 addition & 1 deletion src/lang/builtins/Type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Env } from "../env/index.js"
import { type Env } from "../env/index.ts"

export function compose(env: Env): void {
env.stack.push({
Expand Down
8 changes: 4 additions & 4 deletions src/lang/builtins/apply.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type ComposeOptions } from "../compose/compose.js"
import { composeNode } from "../compose/composeNode.js"
import { type Env } from "../env/index.js"
import { formatValue } from "../value/index.js"
import { type ComposeOptions } from "../compose/compose.ts"
import { composeNode } from "../compose/composeNode.ts"
import { type Env } from "../env/index.ts"
import { formatValue } from "../value/index.ts"

export function compose(env: Env, options: ComposeOptions): void {
const value = env.stack.pop()
Expand Down
10 changes: 5 additions & 5 deletions src/lang/builtins/connect.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type ComposeOptions } from "../compose/compose.js"
import { connect } from "../connect/connect.js"
import { type Env } from "../env/index.js"
import { unifyTypes } from "../unify/unifyTypes.js"
import { formatValue } from "../value/formatValue.js"
import { type ComposeOptions } from "../compose/compose.ts"
import { connect } from "../connect/connect.ts"
import { type Env } from "../env/index.ts"
import { unifyTypes } from "../unify/unifyTypes.ts"
import { formatValue } from "../value/formatValue.ts"

export function compose(env: Env, options: ComposeOptions): void {
const first = env.stack.pop()
Expand Down
6 changes: 3 additions & 3 deletions src/lang/builtins/defineBuiltinOperator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type ComposeOptions } from "../compose/compose.js"
import { type Env } from "../env/index.js"
import { type Mod } from "../mod/index.js"
import { type ComposeOptions } from "../compose/compose.ts"
import { type Env } from "../env/index.ts"
import { type Mod } from "../mod/index.ts"

export function defineBuiltinOperator(
mod: Mod,
Expand Down
20 changes: 10 additions & 10 deletions src/lang/builtins/defineBuiltinOperators.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { type Mod } from "../mod/index.js"
import * as Type from "./Type.js"
import * as apply from "./apply.js"
import * as connect from "./connect.js"
import { defineBuiltinOperator } from "./defineBuiltinOperator.js"
import * as inspect from "./inspect.js"
import * as rot from "./rot.js"
import * as run from "./run.js"
import * as spread from "./spread.js"
import * as swap from "./swap.js"
import { type Mod } from "../mod/index.ts"
import * as Type from "./Type.ts"
import * as apply from "./apply.ts"
import * as connect from "./connect.ts"
import { defineBuiltinOperator } from "./defineBuiltinOperator.ts"
import * as inspect from "./inspect.ts"
import * as rot from "./rot.ts"
import * as run from "./run.ts"
import * as spread from "./spread.ts"
import * as swap from "./swap.ts"

export function defineBuiltinOperators(mod: Mod): void {
defineBuiltinOperator(mod, "swap", swap)
Expand Down
10 changes: 5 additions & 5 deletions src/lang/builtins/inspect.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { indent } from "../../utils/indent.js"
import { type Env } from "../env/index.js"
import { findConnectedComponent } from "../net/findConnectedComponent.js"
import { formatNet } from "../net/formatNet.js"
import { formatValue } from "../value/formatValue.js"
import { indent } from "../../utils/indent.ts"
import { type Env } from "../env/index.ts"
import { findConnectedComponent } from "../net/findConnectedComponent.ts"
import { formatNet } from "../net/formatNet.ts"
import { formatValue } from "../value/formatValue.ts"

export function compose(env: Env): void {
const value = env.stack[env.stack.length - 1]
Expand Down
4 changes: 2 additions & 2 deletions src/lang/builtins/rot.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Env } from "../env/index.js"
import { formatValue } from "../value/formatValue.js"
import { type Env } from "../env/index.ts"
import { formatValue } from "../value/formatValue.ts"

export function compose(env: Env): void {
const first = env.stack.pop()
Expand Down
6 changes: 3 additions & 3 deletions src/lang/builtins/run.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Env } from "../env/index.js"
import { runPort } from "../run/runPort.js"
import { formatValue } from "../value/formatValue.js"
import { type Env } from "../env/index.ts"
import { runPort } from "../run/runPort.ts"
import { formatValue } from "../value/formatValue.ts"

export function compose(env: Env): void {
const port = env.stack.pop()
Expand Down
10 changes: 5 additions & 5 deletions src/lang/builtins/spread.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type ComposeOptions } from "../compose/compose.js"
import { type Env } from "../env/index.js"
import { findInputPorts } from "../net/findInputPorts.js"
import { findOutputPorts } from "../net/findOutputPorts.js"
import { formatValue } from "../value/index.js"
import { type ComposeOptions } from "../compose/compose.ts"
import { type Env } from "../env/index.ts"
import { findInputPorts } from "../net/findInputPorts.ts"
import { findOutputPorts } from "../net/findOutputPorts.ts"
import { formatValue } from "../value/index.ts"

export function compose(env: Env, options: ComposeOptions): void {
const value = env.stack.pop()
Expand Down
4 changes: 2 additions & 2 deletions src/lang/builtins/swap.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Env } from "../env/index.js"
import { formatValue } from "../value/formatValue.js"
import { type Env } from "../env/index.ts"
import { formatValue } from "../value/formatValue.ts"

export function compose(env: Env): void {
const first = env.stack.pop()
Expand Down
16 changes: 8 additions & 8 deletions src/lang/cap/capInputPort.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { connect } from "../connect/connect.js"
import { type Mod } from "../mod/index.js"
import { addNode } from "../net/addNode.js"
import { findNodeEntryOrFail } from "../net/findNodeEntryOrFail.js"
import { findOutputPorts } from "../net/findOutputPorts.js"
import { type Net } from "../net/index.js"
import { type PortExp } from "../port/PortExp.js"
import { type Port } from "../port/index.js"
import { connect } from "../connect/connect.ts"
import { type Mod } from "../mod/index.ts"
import { addNode } from "../net/addNode.ts"
import { findNodeEntryOrFail } from "../net/findNodeEntryOrFail.ts"
import { findOutputPorts } from "../net/findOutputPorts.ts"
import { type Net } from "../net/index.ts"
import { type PortExp } from "../port/PortExp.ts"
import { type Port } from "../port/index.ts"

export function capInputPort(mod: Mod, net: Net, port: Port): Port {
const portExp: PortExp = {
Expand Down
14 changes: 7 additions & 7 deletions src/lang/cap/capNodeAllPorts.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { type Mod } from "../mod/index.js"
import { findInputPorts } from "../net/findInputPorts.js"
import { findOutputPorts } from "../net/findOutputPorts.js"
import { type Net } from "../net/index.js"
import { type Node } from "../node/index.js"
import { capInputPort } from "./capInputPort.js"
import { capOutputPort } from "./capOutputPort.js"
import { type Mod } from "../mod/index.ts"
import { findInputPorts } from "../net/findInputPorts.ts"
import { findOutputPorts } from "../net/findOutputPorts.ts"
import { type Net } from "../net/index.ts"
import { type Node } from "../node/index.ts"
import { capInputPort } from "./capInputPort.ts"
import { capOutputPort } from "./capOutputPort.ts"

export function capNodeAllPorts(mod: Mod, net: Net, node: Node): void {
for (const port of findInputPorts(net, node)) {
Expand Down
14 changes: 7 additions & 7 deletions src/lang/cap/capNodeNonPrinciplePorts.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { type Mod } from "../mod/index.js"
import { findInputPorts } from "../net/findInputPorts.js"
import { findOutputPorts } from "../net/findOutputPorts.js"
import { type Net } from "../net/index.js"
import { type Node } from "../node/index.js"
import { capInputPort } from "./capInputPort.js"
import { capOutputPort } from "./capOutputPort.js"
import { type Mod } from "../mod/index.ts"
import { findInputPorts } from "../net/findInputPorts.ts"
import { findOutputPorts } from "../net/findOutputPorts.ts"
import { type Net } from "../net/index.ts"
import { type Node } from "../node/index.ts"
import { capInputPort } from "./capInputPort.ts"
import { capOutputPort } from "./capOutputPort.ts"

export function capNodeNonPrinciplePorts(mod: Mod, net: Net, node: Node): void {
for (const port of findInputPorts(net, node)) {
Expand Down
16 changes: 8 additions & 8 deletions src/lang/cap/capOutputPort.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { connect } from "../connect/connect.js"
import { type Mod } from "../mod/index.js"
import { addNode } from "../net/addNode.js"
import { findInputPorts } from "../net/findInputPorts.js"
import { findNodeEntryOrFail } from "../net/findNodeEntryOrFail.js"
import { type Net } from "../net/index.js"
import { type PortExp } from "../port/PortExp.js"
import { type Port } from "../port/index.js"
import { connect } from "../connect/connect.ts"
import { type Mod } from "../mod/index.ts"
import { addNode } from "../net/addNode.ts"
import { findInputPorts } from "../net/findInputPorts.ts"
import { findNodeEntryOrFail } from "../net/findNodeEntryOrFail.ts"
import { type Net } from "../net/index.ts"
import { type PortExp } from "../port/PortExp.ts"
import { type Port } from "../port/index.ts"

export function capOutputPort(mod: Mod, net: Net, port: Port): Port {
const portExp: PortExp = {
Expand Down
16 changes: 8 additions & 8 deletions src/lang/cap/capType.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { type Mod } from "../mod/index.js"
import { addNode } from "../net/addNode.js"
import { findNodeEntryOrFail } from "../net/findNodeEntryOrFail.js"
import { findOutputPorts } from "../net/findOutputPorts.js"
import { type Net } from "../net/index.js"
import { type PortExp } from "../port/PortExp.js"
import { type Port } from "../port/index.js"
import { type Value } from "../value/index.js"
import { type Mod } from "../mod/index.ts"
import { addNode } from "../net/addNode.ts"
import { findNodeEntryOrFail } from "../net/findNodeEntryOrFail.ts"
import { findOutputPorts } from "../net/findOutputPorts.ts"
import { type Net } from "../net/index.ts"
import { type PortExp } from "../port/PortExp.ts"
import { type Port } from "../port/index.ts"
import { type Value } from "../value/index.ts"

export function capType(mod: Mod, net: Net, t: Value): Port {
const portExp: PortExp = {
Expand Down
10 changes: 5 additions & 5 deletions src/lang/cap/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from "./capInputPort.js"
export * from "./capNodeAllPorts.js"
export * from "./capNodeNonPrinciplePorts.js"
export * from "./capOutputPort.js"
export * from "./capType.js"
export * from "./capInputPort.ts"
export * from "./capNodeAllPorts.ts"
export * from "./capNodeNonPrinciplePorts.ts"
export * from "./capOutputPort.ts"
export * from "./capType.ts"
2 changes: 1 addition & 1 deletion src/lang/check/checkAllLocalsAreUsed.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Value } from "../value/index.js"
import { type Value } from "../value/index.ts"

export function checkAllLocalsAreUsed(locals: Map<string, Value>): void {
if (locals.size > 0) {
Expand Down
18 changes: 9 additions & 9 deletions src/lang/check/checkNode.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { createChecking } from "../checking/createChecking.js"
import { collectWords } from "../compose/collectWords.js"
import { createEnv } from "../env/createEnv.js"
import { type Mod } from "../mod/index.js"
import { type PortExp } from "../port/PortExp.js"
import { formatValue } from "../value/formatValue.js"
import { type Value } from "../value/index.js"
import { type Word } from "../word/index.js"
import { checkAllLocalsAreUsed } from "./checkAllLocalsAreUsed.js"
import { createChecking } from "../checking/createChecking.ts"
import { collectWords } from "../compose/collectWords.ts"
import { createEnv } from "../env/createEnv.ts"
import { type Mod } from "../mod/index.ts"
import { type PortExp } from "../port/PortExp.ts"
import { formatValue } from "../value/formatValue.ts"
import { type Value } from "../value/index.ts"
import { type Word } from "../word/index.ts"
import { checkAllLocalsAreUsed } from "./checkAllLocalsAreUsed.ts"

export function checkNode(
mod: Mod,
Expand Down
Loading

0 comments on commit bd79e82

Please sign in to comment.