Skip to content

Commit

Permalink
use "rewriteRelativeImportExtensions"
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Dec 4, 2024
1 parent 6d9fcf6 commit c2cd596
Show file tree
Hide file tree
Showing 204 changed files with 948 additions and 941 deletions.
320 changes: 163 additions & 157 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
"picocolors": "^1.1.1"
},
"devDependencies": {
"@types/node": "^22.9.0",
"@types/node": "^22.10.1",
"@xieyuheng/test-runner": "^0.2.10",
"prettier": "^3.3.3",
"prettier": "^3.4.1",
"prettier-plugin-organize-imports": "^4.1.0",
"typescript": "^5.6.3",
"vitest": "^2.1.5"
"typescript": "^5.7.2",
"vitest": "^2.1.8"
}
}
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
12 changes: 6 additions & 6 deletions src/app/AppReplEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ 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 { execute } from "../lang/execute/index.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 { execute } from "../lang/execute/index.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 "../commands/index.js"
import { version } from "../../version.ts"
import * as Commands from "../commands/index.ts"

type Args = { path?: string }
type Opts = { help?: boolean; version?: boolean }
Expand Down
10 changes: 5 additions & 5 deletions src/command-line/commands/Format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ 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 { formatStmt } from "../../lang/stmt/index.js"
import { parseStmts } from "../../lang/syntax/index.js"
import { createURL } from "../../utils/createURL.js"
import { Fetcher } from "../../fetcher/index.ts"
import { Report } from "../../lang/errors/Report.ts"
import { formatStmt } from "../../lang/stmt/index.ts"
import { parseStmts } from "../../lang/syntax/index.ts"
import { createURL } from "../../utils/createURL.ts"

type Args = { path: string }
type Opts = {}
Expand Down
8 changes: 4 additions & 4 deletions src/command-line/commands/Parse.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 { parseStmts } from "../../lang/syntax/index.js"
import { createURL } from "../../utils/createURL.js"
import { Fetcher } from "../../fetcher/index.ts"
import { Report } from "../../lang/errors/Report.ts"
import { parseStmts } from "../../lang/syntax/index.ts"
import { createURL } from "../../utils/createURL.ts"

type Args = { path: string }
type Opts = {}
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
10 changes: 5 additions & 5 deletions src/command-line/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from "@xieyuheng/command-line/lib/commands/index.js"
export * from "./Default.js"
export * from "./Format.js"
export * from "./Parse.js"
export * from "./Repl.js"
export * from "./Run.js"
export * from "./Default.ts"
export * from "./Format.ts"
export * from "./Parse.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"
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./fetcher/index.js"
export * from "./lang/index.js"
export * from "./loader/index.js"
export * from "./fetcher/index.ts"
export * from "./lang/index.ts"
export * from "./loader/index.ts"
12 changes: 6 additions & 6 deletions src/lang/apply/apply.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { type Env } from "../env/index.js"
import { type EvaluateOptions } from "../evaluate/index.js"
import { formatValue, type Value } from "../value/index.js"
import { applyFunction } from "./applyFunction.js"
import { applyNode } from "./applyNode.js"
import { applyTypeCtor } from "./applyTypeCtor.js"
import { type Env } from "../env/index.ts"
import { type EvaluateOptions } from "../evaluate/index.ts"
import { formatValue, type Value } from "../value/index.ts"
import { applyFunction } from "./applyFunction.ts"
import { applyNode } from "./applyNode.ts"
import { applyTypeCtor } from "./applyTypeCtor.ts"

export function apply(
env: Env,
Expand Down
18 changes: 9 additions & 9 deletions src/lang/apply/applyFunction.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { manyTimes } from "../../utils/manyTimes.js"
import { connectValues } from "../connect/connectValues.js"
import { defineLocals } from "../env/defineLocals.js"
import { type Env } from "../env/index.js"
import { evaluateBlock } from "../evaluate/evaluateBlock.js"
import { type EvaluateOptions } from "../evaluate/index.js"
import { addEdge } from "../net/addEdge.js"
import { formatValues } from "../value/formatValues.js"
import { formatValue, type Function, type Value } from "../value/index.js"
import { manyTimes } from "../../utils/manyTimes.ts"
import { connectValues } from "../connect/connectValues.ts"
import { defineLocals } from "../env/defineLocals.ts"
import { type Env } from "../env/index.ts"
import { evaluateBlock } from "../evaluate/evaluateBlock.ts"
import { type EvaluateOptions } from "../evaluate/index.ts"
import { addEdge } from "../net/addEdge.ts"
import { formatValues } from "../value/formatValues.ts"
import { formatValue, type Function, type Value } from "../value/index.ts"

export function applyFunction(
env: Env,
Expand Down
22 changes: 11 additions & 11 deletions src/lang/apply/applyNode.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { checkHalfEdges } from "../check/checkHalfEdges.js"
import { connectHalfEdges } from "../connect/connectHalfEdges.js"
import { type Env } from "../env/index.js"
import { type EvaluateOptions } from "../evaluate/index.js"
import { refreshNode } from "../freshen/refreshNode.js"
import { halfEdgeFromPort } from "../half-edge/halfEdgeFromPort.js"
import { findInputPorts } from "../net/findInputPorts.js"
import { findOutputPorts } from "../net/findOutputPorts.js"
import { formatNode, type Node } from "../node/index.js"
import { formatPort } from "../port/formatPort.js"
import { formatValue, type Value } from "../value/index.js"
import { checkHalfEdges } from "../check/checkHalfEdges.ts"
import { connectHalfEdges } from "../connect/connectHalfEdges.ts"
import { type Env } from "../env/index.ts"
import { type EvaluateOptions } from "../evaluate/index.ts"
import { refreshNode } from "../freshen/refreshNode.ts"
import { halfEdgeFromPort } from "../half-edge/halfEdgeFromPort.ts"
import { findInputPorts } from "../net/findInputPorts.ts"
import { findOutputPorts } from "../net/findOutputPorts.ts"
import { formatNode, type Node } from "../node/index.ts"
import { formatPort } from "../port/formatPort.ts"
import { formatValue, type Value } from "../value/index.ts"

export function applyNode(
env: Env,
Expand Down
12 changes: 6 additions & 6 deletions src/lang/apply/applyTypeCtor.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { checkTypeTermArgs } from "../check/checkTypeTermArgs.js"
import { type Env } from "../env/index.js"
import { type EvaluateOptions } from "../evaluate/index.js"
import { formatParameters } from "../parameter/index.js"
import { formatValues } from "../value/formatValues.js"
import { type TypeCtor, type Value } from "../value/index.js"
import { checkTypeTermArgs } from "../check/checkTypeTermArgs.ts"
import { type Env } from "../env/index.ts"
import { type EvaluateOptions } from "../evaluate/index.ts"
import { formatParameters } from "../parameter/index.ts"
import { formatValues } from "../value/formatValues.ts"
import { type TypeCtor, type Value } from "../value/index.ts"

export function applyTypeCtor(
env: Env,
Expand Down
2 changes: 1 addition & 1 deletion src/lang/apply/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./apply.js"
export * from "./apply.ts"
8 changes: 4 additions & 4 deletions src/lang/builtins/connect.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { checkHalfEdges } from "../check/checkHalfEdges.js"
import { connectHalfEdges } from "../connect/connectHalfEdges.js"
import { type PrimitiveApply } from "../definition/index.js"
import { formatValue } from "../value/formatValue.js"
import { checkHalfEdges } from "../check/checkHalfEdges.ts"
import { connectHalfEdges } from "../connect/connectHalfEdges.ts"
import { type PrimitiveApply } from "../definition/index.ts"
import { formatValue } from "../value/formatValue.ts"

export const apply: PrimitiveApply = (env, args, options) => {
if (args.length !== 2) {
Expand Down
4 changes: 2 additions & 2 deletions src/lang/builtins/defineBuiltinPrimitiveFunction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type PrimitiveApply } from "../definition/index.js"
import { type Mod } from "../mod/index.js"
import { type PrimitiveApply } from "../definition/index.ts"
import { type Mod } from "../mod/index.ts"

export function defineBuiltinPrimitiveFunction(
mod: Mod,
Expand Down
4 changes: 2 additions & 2 deletions src/lang/builtins/defineBuiltinValue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Mod } from "../mod/index.js"
import { type Value } from "../value/index.js"
import { type Mod } from "../mod/index.ts"
import { type Value } from "../value/index.ts"

export function defineBuiltinValue(mod: Mod, name: string, value: Value): void {
mod.builtins.set(name, {
Expand Down
12 changes: 6 additions & 6 deletions src/lang/builtins/defineBuiltins.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { type Mod } from "../mod/index.js"
import * as connect from "./connect.js"
import { defineBuiltinPrimitiveFunction } from "./defineBuiltinPrimitiveFunction.js"
import { defineBuiltinValue } from "./defineBuiltinValue.js"
import * as inspect from "./inspect.js"
import * as run from "./run.js"
import { type Mod } from "../mod/index.ts"
import * as connect from "./connect.ts"
import { defineBuiltinPrimitiveFunction } from "./defineBuiltinPrimitiveFunction.ts"
import { defineBuiltinValue } from "./defineBuiltinValue.ts"
import * as inspect from "./inspect.ts"
import * as run from "./run.ts"

export function defineBuiltins(mod: Mod): void {
defineBuiltinPrimitiveFunction(mod, "connect", connect)
Expand Down
16 changes: 8 additions & 8 deletions src/lang/builtins/inspect.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { indent } from "../../utils/indent.js"
import { type PrimitiveApply } from "../definition/index.js"
import { findConnectedComponent } from "../net/findConnectedComponent.js"
import { findHalfEdgeEntryOrFail } from "../net/findHalfEdgeEntryOrFail.js"
import { findHalfEdgePortOrFail } from "../net/findHalfEdgePortOrFail.js"
import { formatNet } from "../net/formatNet.js"
import { formatPort } from "../port/formatPort.js"
import { formatValue } from "../value/formatValue.js"
import { indent } from "../../utils/indent.ts"
import { type PrimitiveApply } from "../definition/index.ts"
import { findConnectedComponent } from "../net/findConnectedComponent.ts"
import { findHalfEdgeEntryOrFail } from "../net/findHalfEdgeEntryOrFail.ts"
import { findHalfEdgePortOrFail } from "../net/findHalfEdgePortOrFail.ts"
import { formatNet } from "../net/formatNet.ts"
import { formatPort } from "../port/formatPort.ts"
import { formatValue } from "../value/formatValue.ts"

export const apply: PrimitiveApply = (env, args) => {
if (args.length !== 1) {
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 PrimitiveApply } from "../definition/index.js"
import { runHalfEdge } from "../run/runHalfEdge.js"
import { formatValue } from "../value/formatValue.js"
import { type PrimitiveApply } from "../definition/index.ts"
import { runHalfEdge } from "../run/runHalfEdge.ts"
import { formatValue } from "../value/formatValue.ts"

export const apply: PrimitiveApply = (env, args) => {
if (args.length !== 1) {
Expand Down
14 changes: 7 additions & 7 deletions src/lang/cap/capInputPort.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { connectPorts } from "../connect/connectPorts.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 Port } from "../port/index.js"
import { connectPorts } from "../connect/connectPorts.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 Port } from "../port/index.ts"

export function capInputPort(mod: Mod, net: Net, port: Port): Port {
const parameter = {
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
14 changes: 7 additions & 7 deletions src/lang/cap/capOutputPort.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { connectPorts } from "../connect/connectPorts.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 Port } from "../port/index.js"
import { connectPorts } from "../connect/connectPorts.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 Port } from "../port/index.ts"

export function capOutputPort(mod: Mod, net: Net, port: Port): Port {
const parameter = {
Expand Down
14 changes: 7 additions & 7 deletions src/lang/cap/capType.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
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 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 Port } from "../port/index.ts"
import { type Value } from "../value/index.ts"

export function capType(mod: Mod, net: Net, t: Value): Port {
const parameter = {
Expand Down
Loading

0 comments on commit c2cd596

Please sign in to comment.