diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index cde952be..00000000 --- a/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -TODO.md \ No newline at end of file diff --git a/TODO.md b/TODO.md index 60384100..bcf5025d 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,3 @@ -更新 TS 项目用 esmodule 删除类型系统,并补充相关笔记 更改命名惯例为 lisp-case diff --git a/bin/inet.js b/bin/inet.js index 0a2e9346..4902510e 100755 --- a/bin/inet.js +++ b/bin/inet.js @@ -1,12 +1,5 @@ #!/usr/bin/env node -const process = require("process") - -process.on("unhandledRejection", (error) => { - console.error(error) - process.exit(1) -}) - -const { createCommandRunner } = require("../lib/command-line") +import { createCommandRunner } from "../lib/command-line/index.js" createCommandRunner().run() diff --git a/package.json b/package.json index 9a01ebe8..a1d6bac3 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,12 @@ "name": "@cicada-lang/inet", "version": "0.2.0", "repository": "github:cicada-lang/inet", + "license": "GPL-3.0-or-later", + "type": "module", "main": "./lib/index.js", "files": [ - "lib" + "lib", + "src" ], "bin": { "inet": "bin/inet.js" @@ -18,13 +21,6 @@ "test": "npm run test:ts && npm run test:inet && npm run test:inet-error", "format": "prettier src docs --write" }, - "devDependencies": { - "@types/node": "^20.8.10", - "@xieyuheng/test-runner": "^0.2.10", - "prettier": "^3.0.3", - "prettier-plugin-organize-imports": "^3.2.3", - "typescript": "^5.2.2" - }, "dependencies": { "@cicada-lang/framework": "^0.1.6", "@cicada-lang/partech": "^0.2.5", @@ -33,5 +29,11 @@ "picocolors": "^1.0.0", "vitest": "^0.34.6" }, - "license": "GPL-3.0-or-later" + "devDependencies": { + "@types/node": "^20.8.10", + "@xieyuheng/test-runner": "^0.2.10", + "prettier": "^3.0.3", + "prettier-plugin-organize-imports": "^3.2.3", + "typescript": "^5.2.2" + } } diff --git a/src/app/App.ts b/src/app/App.ts index fed69801..ad55c90d 100644 --- a/src/app/App.ts +++ b/src/app/App.ts @@ -1,9 +1,7 @@ -import { AppConfig } from "./AppConfig" import { AppHome } from "./AppHome.js" -import { AppReplEventHandler } from "./AppReplEventHandler" +import { AppReplEventHandler } from "./AppReplEventHandler.js" export class App { home = new AppHome() - config = new AppConfig() replEventHandler = new AppReplEventHandler() } diff --git a/src/app/AppConfig.ts b/src/app/AppConfig.ts deleted file mode 100644 index b41ad409..00000000 --- a/src/app/AppConfig.ts +++ /dev/null @@ -1,9 +0,0 @@ -export class AppConfig { - packageJson: any - - constructor() { - // NOTE We should not use import for module not in `src/`, - // otherwise `lib/` will have a extra level. - this.packageJson = require("../../package.json") - } -} diff --git a/src/app/AppHome.ts b/src/app/AppHome.ts index ca69daa0..8eb39648 100644 --- a/src/app/AppHome.ts +++ b/src/app/AppHome.ts @@ -1,4 +1,4 @@ -import { LocalFileStore } from "@cicada-lang/framework/lib/file-stores/LocalFileStore" +import { LocalFileStore } from "@cicada-lang/framework/lib/file-stores/LocalFileStore.js" import os from "os" import Path from "path" import process from "process" diff --git a/src/app/AppReplEventHandler.ts b/src/app/AppReplEventHandler.ts index 76a78212..c96b4442 100644 --- a/src/app/AppReplEventHandler.ts +++ b/src/app/AppReplEventHandler.ts @@ -1,13 +1,16 @@ -import { ReplEvent, ReplEventHandler } from "@cicada-lang/framework/lib/repl" +import { + ReplEventHandler, + type ReplEvent, +} from "@cicada-lang/framework/lib/repl/index.js" import { ParsingError } from "@cicada-lang/partech" import fs from "fs" import { relative } from "node:path" import process from "process" -import { app } from "../app" import { Fetcher } from "../fetcher/Fetcher.js" import { Report } from "../lang/errors/Report.js" import { parseStmts } from "../lang/syntax/index.js" -import { Loader } from "../loader" +import { Loader } from "../loader/index.js" +import { version } from "../version.js" const fetcher = new Fetcher() @@ -42,7 +45,7 @@ export class AppReplEventHandler extends ReplEventHandler { loader = new Loader({ fetcher }) greeting(): void { - console.log(`iNet Cute ${app.config.packageJson.version}`) + console.log(`iNet Cute ${version}`) } async handle(event: ReplEvent): Promise { diff --git a/src/app/index.ts b/src/app/index.ts index 1340bf40..013f2712 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -1,3 +1,3 @@ -import { App } from "./App" +import { App } from "./App.js" export const app = new App() diff --git a/src/command-line/commands/Default.ts b/src/command-line/commands/Default.ts index 095927ef..313ce534 100644 --- a/src/command-line/commands/Default.ts +++ b/src/command-line/commands/Default.ts @@ -1,6 +1,6 @@ import { Command, CommandRunner } from "@xieyuheng/command-line" import { ty } from "@xieyuheng/ty" -import { app } from "../../app/index.js" +import { version } from "../../version.js" import * as Commands from "./index.js" type Args = { path?: string } @@ -26,7 +26,7 @@ export class Default extends Command { } if (argv["version"]) { - console.log(app.config.packageJson.version) + console.log(version) return } diff --git a/src/command-line/commands/Repl.ts b/src/command-line/commands/Repl.ts index bac8dcbd..478087bd 100644 --- a/src/command-line/commands/Repl.ts +++ b/src/command-line/commands/Repl.ts @@ -1,7 +1,7 @@ -import { ReadlineRepl } from "@cicada-lang/framework/lib/repls/readline-repl" +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" +import { app } from "../../app/index.js" type Args = {} diff --git a/src/command-line/commands/Run.ts b/src/command-line/commands/Run.ts index 75d04404..34f1d98c 100644 --- a/src/command-line/commands/Run.ts +++ b/src/command-line/commands/Run.ts @@ -1,13 +1,13 @@ -import { ParsingError } from "@cicada-lang/partech/lib/errors" +import { ParsingError } from "@cicada-lang/partech" import { Command, CommandRunner } from "@xieyuheng/command-line" import { ty } from "@xieyuheng/ty" import fs from "node:fs" import { relative } from "node:path" import process from "node:process" -import { Fetcher } from "../../fetcher" -import { Report } from "../../lang/errors/Report" -import { Loader } from "../../loader" -import { createURL } from "../../utils/createURL" +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" type Args = { path: string } type Opts = {} diff --git a/src/command-line/commands/index.ts b/src/command-line/commands/index.ts index 8129549f..be99c0dd 100644 --- a/src/command-line/commands/index.ts +++ b/src/command-line/commands/index.ts @@ -1,4 +1,4 @@ -export * from "@xieyuheng/command-line/lib/commands" -export * from "./Default" -export * from "./Repl" -export * from "./Run" +export * from "@xieyuheng/command-line/lib/commands/index.js" +export * from "./Default.js" +export * from "./Repl.js" +export * from "./Run.js" diff --git a/src/command-line/index.ts b/src/command-line/index.ts index 42820e6a..adf4d238 100644 --- a/src/command-line/index.ts +++ b/src/command-line/index.ts @@ -1,5 +1,5 @@ import { CommandRunner, CommandRunners } from "@xieyuheng/command-line" -import * as Commands from "./commands" +import * as Commands from "./commands/index.js" export function createCommandRunner(): CommandRunner { return new CommandRunners.CommonCommandRunner({ diff --git a/src/fetcher/index.ts b/src/fetcher/index.ts index 540c9da7..0e7aced4 100644 --- a/src/fetcher/index.ts +++ b/src/fetcher/index.ts @@ -1 +1 @@ -export * from "./Fetcher" +export * from "./Fetcher.js" diff --git a/src/index.ts b/src/index.ts index 7f42dcb3..a88ed10b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,18 +1,18 @@ -export * from "./fetcher" -export * from "./lang/cap" -export * from "./lang/definition" -export * from "./lang/edge" -export * from "./lang/env" -export * from "./lang/errors" -export * from "./lang/interact" -export * from "./lang/mod" -export * from "./lang/net" -export * from "./lang/node" -export * from "./lang/port" -export * from "./lang/present" -export * from "./lang/rule" -export * from "./lang/run" -export * from "./lang/syntax" -export * from "./lang/value" -export * from "./lang/word" -export * from "./loader" +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" diff --git a/src/lang/builtins/Type.ts b/src/lang/builtins/Type.ts index ffc2e100..9c7db3a0 100644 --- a/src/lang/builtins/Type.ts +++ b/src/lang/builtins/Type.ts @@ -1,4 +1,4 @@ -import { Env } from "../env" +import { type Env } from "../env/index.js" export function compose(env: Env): void { env.stack.push({ diff --git a/src/lang/builtins/apply.ts b/src/lang/builtins/apply.ts index eb41574a..785ecf1e 100644 --- a/src/lang/builtins/apply.ts +++ b/src/lang/builtins/apply.ts @@ -1,7 +1,7 @@ -import { ComposeOptions } from "../compose/compose" -import { composeNode } from "../compose/composeNode" -import { Env } from "../env" -import { formatValue } from "../value" +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" export function compose(env: Env, options: ComposeOptions): void { const value = env.stack.pop() diff --git a/src/lang/builtins/connect.ts b/src/lang/builtins/connect.ts index 4b9c5a41..8ecffddc 100644 --- a/src/lang/builtins/connect.ts +++ b/src/lang/builtins/connect.ts @@ -1,8 +1,8 @@ -import { ComposeOptions } from "../compose/compose" -import { connect } from "../connect/connect" -import { Env } from "../env" -import { unifyTypes } from "../unify/unifyTypes" -import { formatValue } from "../value/formatValue" +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" export function compose(env: Env, options: ComposeOptions): void { const first = env.stack.pop() diff --git a/src/lang/builtins/defineBuiltinOperator.ts b/src/lang/builtins/defineBuiltinOperator.ts index bd2d1adb..0f2e80f3 100644 --- a/src/lang/builtins/defineBuiltinOperator.ts +++ b/src/lang/builtins/defineBuiltinOperator.ts @@ -1,6 +1,6 @@ -import { ComposeOptions } from "../compose/compose" -import { Env } from "../env" -import { Mod } from "../mod" +import { type ComposeOptions } from "../compose/compose.js" +import { type Env } from "../env/index.js" +import { type Mod } from "../mod/index.js" export function defineBuiltinOperator( mod: Mod, diff --git a/src/lang/builtins/defineBuiltinOperators.ts b/src/lang/builtins/defineBuiltinOperators.ts index bcec382d..25d1a806 100644 --- a/src/lang/builtins/defineBuiltinOperators.ts +++ b/src/lang/builtins/defineBuiltinOperators.ts @@ -1,13 +1,13 @@ -import { Mod } from "../mod" -import * as Type from "./Type" -import * as apply from "./apply" -import * as connect from "./connect" -import { defineBuiltinOperator } from "./defineBuiltinOperator" -import * as inspect from "./inspect" -import * as rot from "./rot" -import * as run from "./run" -import * as spread from "./spread" -import * as swap from "./swap" +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" export function defineBuiltinOperators(mod: Mod): void { defineBuiltinOperator(mod, "swap", swap) diff --git a/src/lang/builtins/inspect.ts b/src/lang/builtins/inspect.ts index 29793786..8de12f6c 100644 --- a/src/lang/builtins/inspect.ts +++ b/src/lang/builtins/inspect.ts @@ -1,8 +1,8 @@ -import { indent } from "../../utils/indent" -import { Env } from "../env" -import { findConnectedComponent } from "../net/findConnectedComponent" -import { formatNet } from "../net/formatNet" -import { formatValue } from "../value/formatValue" +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" export function compose(env: Env): void { const value = env.stack[env.stack.length - 1] diff --git a/src/lang/builtins/rot.ts b/src/lang/builtins/rot.ts index 729c845b..4f64aa18 100644 --- a/src/lang/builtins/rot.ts +++ b/src/lang/builtins/rot.ts @@ -1,5 +1,5 @@ -import { Env } from "../env" -import { formatValue } from "../value/formatValue" +import { type Env } from "../env/index.js" +import { formatValue } from "../value/formatValue.js" export function compose(env: Env): void { const first = env.stack.pop() diff --git a/src/lang/builtins/run.ts b/src/lang/builtins/run.ts index fb04bb1c..4563e0fd 100644 --- a/src/lang/builtins/run.ts +++ b/src/lang/builtins/run.ts @@ -1,6 +1,6 @@ -import { Env } from "../env" -import { runPort } from "../run/runPort" -import { formatValue } from "../value/formatValue" +import { type Env } from "../env/index.js" +import { runPort } from "../run/runPort.js" +import { formatValue } from "../value/formatValue.js" export function compose(env: Env): void { const port = env.stack.pop() diff --git a/src/lang/builtins/spread.ts b/src/lang/builtins/spread.ts index 834f9c1a..3dad0911 100644 --- a/src/lang/builtins/spread.ts +++ b/src/lang/builtins/spread.ts @@ -1,8 +1,8 @@ -import { ComposeOptions } from "../compose/compose" -import { Env } from "../env" -import { findInputPorts } from "../net/findInputPorts" -import { findOutputPorts } from "../net/findOutputPorts" -import { formatValue } from "../value" +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" export function compose(env: Env, options: ComposeOptions): void { const value = env.stack.pop() diff --git a/src/lang/builtins/swap.ts b/src/lang/builtins/swap.ts index 775ad797..d6e7098a 100644 --- a/src/lang/builtins/swap.ts +++ b/src/lang/builtins/swap.ts @@ -1,5 +1,5 @@ -import { Env } from "../env" -import { formatValue } from "../value/formatValue" +import { type Env } from "../env/index.js" +import { formatValue } from "../value/formatValue.js" export function compose(env: Env): void { const first = env.stack.pop() diff --git a/src/lang/cap/capInputPort.ts b/src/lang/cap/capInputPort.ts index 2d467a1f..6b7bb549 100644 --- a/src/lang/cap/capInputPort.ts +++ b/src/lang/cap/capInputPort.ts @@ -1,11 +1,11 @@ -import { connect } from "../connect/connect" -import { Mod } from "../mod" -import { Net } from "../net" -import { addNode } from "../net/addNode" -import { findNodeEntryOrFail } from "../net/findNodeEntryOrFail" -import { findOutputPorts } from "../net/findOutputPorts" -import { Port } from "../port" -import { PortExp } from "../port/PortExp" +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" export function capInputPort(mod: Mod, net: Net, port: Port): Port { const portExp: PortExp = { diff --git a/src/lang/cap/capNodeAllPorts.ts b/src/lang/cap/capNodeAllPorts.ts index c777595d..ea62eb23 100644 --- a/src/lang/cap/capNodeAllPorts.ts +++ b/src/lang/cap/capNodeAllPorts.ts @@ -1,10 +1,10 @@ -import { Mod } from "../mod" -import { Net } from "../net" -import { findInputPorts } from "../net/findInputPorts" -import { findOutputPorts } from "../net/findOutputPorts" -import { Node } from "../node" -import { capInputPort } from "./capInputPort" -import { capOutputPort } from "./capOutputPort" +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" export function capNodeAllPorts(mod: Mod, net: Net, node: Node): void { for (const port of findInputPorts(net, node)) { diff --git a/src/lang/cap/capNodeNonPrinciplePorts.ts b/src/lang/cap/capNodeNonPrinciplePorts.ts index cb583360..6ba55d07 100644 --- a/src/lang/cap/capNodeNonPrinciplePorts.ts +++ b/src/lang/cap/capNodeNonPrinciplePorts.ts @@ -1,10 +1,10 @@ -import { Mod } from "../mod" -import { Net } from "../net" -import { findInputPorts } from "../net/findInputPorts" -import { findOutputPorts } from "../net/findOutputPorts" -import { Node } from "../node" -import { capInputPort } from "./capInputPort" -import { capOutputPort } from "./capOutputPort" +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" export function capNodeNonPrinciplePorts(mod: Mod, net: Net, node: Node): void { for (const port of findInputPorts(net, node)) { diff --git a/src/lang/cap/capOutputPort.ts b/src/lang/cap/capOutputPort.ts index e43c9be8..1a2561e8 100644 --- a/src/lang/cap/capOutputPort.ts +++ b/src/lang/cap/capOutputPort.ts @@ -1,11 +1,11 @@ -import { connect } from "../connect/connect" -import { Mod } from "../mod" -import { Net } from "../net" -import { addNode } from "../net/addNode" -import { findInputPorts } from "../net/findInputPorts" -import { findNodeEntryOrFail } from "../net/findNodeEntryOrFail" -import { Port } from "../port" -import { PortExp } from "../port/PortExp" +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" export function capOutputPort(mod: Mod, net: Net, port: Port): Port { const portExp: PortExp = { diff --git a/src/lang/cap/capType.ts b/src/lang/cap/capType.ts index 54cd5fb9..49443d8d 100644 --- a/src/lang/cap/capType.ts +++ b/src/lang/cap/capType.ts @@ -1,11 +1,11 @@ -import { Mod } from "../mod" -import { Net } from "../net" -import { addNode } from "../net/addNode" -import { findNodeEntryOrFail } from "../net/findNodeEntryOrFail" -import { findOutputPorts } from "../net/findOutputPorts" -import { Port } from "../port" -import { PortExp } from "../port/PortExp" -import { Value } from "../value" +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" export function capType(mod: Mod, net: Net, t: Value): Port { const portExp: PortExp = { diff --git a/src/lang/cap/index.ts b/src/lang/cap/index.ts index a8a72336..c31b16fa 100644 --- a/src/lang/cap/index.ts +++ b/src/lang/cap/index.ts @@ -1,5 +1,5 @@ -export * from "./capInputPort" -export * from "./capNodeAllPorts" -export * from "./capNodeNonPrinciplePorts" -export * from "./capOutputPort" -export * from "./capType" +export * from "./capInputPort.js" +export * from "./capNodeAllPorts.js" +export * from "./capNodeNonPrinciplePorts.js" +export * from "./capOutputPort.js" +export * from "./capType.js" diff --git a/src/lang/check/checkAllLocalsAreUsed.ts b/src/lang/check/checkAllLocalsAreUsed.ts index bbabd6e6..e7704bd2 100644 --- a/src/lang/check/checkAllLocalsAreUsed.ts +++ b/src/lang/check/checkAllLocalsAreUsed.ts @@ -1,4 +1,4 @@ -import { Value } from "../value" +import { type Value } from "../value/index.js" export function checkAllLocalsAreUsed(locals: Map): void { if (locals.size > 0) { diff --git a/src/lang/check/checkNode.ts b/src/lang/check/checkNode.ts index 0d93df7a..ff485802 100644 --- a/src/lang/check/checkNode.ts +++ b/src/lang/check/checkNode.ts @@ -1,12 +1,12 @@ -import { createChecking } from "../checking/createChecking" -import { collectWords } from "../compose/collectWords" -import { createEnv } from "../env/createEnv" -import { Mod } from "../mod" -import { PortExp } from "../port/PortExp" -import { Value } from "../value" -import { formatValue } from "../value/formatValue" -import { Word } from "../word" -import { checkAllLocalsAreUsed } from "./checkAllLocalsAreUsed" +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" export function checkNode( mod: Mod, diff --git a/src/lang/check/checkPortSigns.ts b/src/lang/check/checkPortSigns.ts index d99631fa..2e214206 100644 --- a/src/lang/check/checkPortSigns.ts +++ b/src/lang/check/checkPortSigns.ts @@ -1,5 +1,5 @@ -import { Port } from "../port" -import { formatValue } from "../value/formatValue" +import { type Port } from "../port/index.js" +import { formatValue } from "../value/formatValue.js" export function checkPortSigns(first: Port, second: Port): void { if (first.sign === 1 && second.sign === 1) { diff --git a/src/lang/check/checkRule.ts b/src/lang/check/checkRule.ts index ca56c293..a879f09c 100644 --- a/src/lang/check/checkRule.ts +++ b/src/lang/check/checkRule.ts @@ -1,13 +1,13 @@ -import { capNodeNonPrinciplePorts } from "../cap/capNodeNonPrinciplePorts" -import { createChecking } from "../checking/createChecking" -import { compose } from "../compose/compose" -import { createEnv } from "../env/createEnv" -import { refreshNode } from "../freshen/refreshNode" -import { Mod } from "../mod" -import { findDefinitionOrFail } from "../mod/findDefinitionOrFail" -import { createNodeFromDefinition } from "../node/createNodeFromDefinition" -import { Word } from "../word" -import { checkAllLocalsAreUsed } from "./checkAllLocalsAreUsed" +import { capNodeNonPrinciplePorts } from "../cap/capNodeNonPrinciplePorts.js" +import { createChecking } from "../checking/createChecking.js" +import { compose } from "../compose/compose.js" +import { createEnv } from "../env/createEnv.js" +import { refreshNode } from "../freshen/refreshNode.js" +import { findDefinitionOrFail } from "../mod/findDefinitionOrFail.js" +import { type Mod } from "../mod/index.js" +import { createNodeFromDefinition } from "../node/createNodeFromDefinition.js" +import { type Word } from "../word/index.js" +import { checkAllLocalsAreUsed } from "./checkAllLocalsAreUsed.js" export function checkRule( mod: Mod, diff --git a/src/lang/check/checkRuleIsAboutOwnNode.ts b/src/lang/check/checkRuleIsAboutOwnNode.ts index 2a31b872..340da947 100644 --- a/src/lang/check/checkRuleIsAboutOwnNode.ts +++ b/src/lang/check/checkRuleIsAboutOwnNode.ts @@ -1,5 +1,5 @@ -import { Mod } from "../mod" -import { findDefinitionOrFail } from "../mod/findDefinitionOrFail" +import { findDefinitionOrFail } from "../mod/findDefinitionOrFail.js" +import { type Mod } from "../mod/index.js" export function checkRuleIsAboutOwnNode( mod: Mod, diff --git a/src/lang/check/checkRuleNodeOrder.ts b/src/lang/check/checkRuleNodeOrder.ts index e25fedaa..8810966b 100644 --- a/src/lang/check/checkRuleNodeOrder.ts +++ b/src/lang/check/checkRuleNodeOrder.ts @@ -1,5 +1,5 @@ -import { Mod } from "../mod" -import { findDefinitionOrFail } from "../mod/findDefinitionOrFail" +import { findDefinitionOrFail } from "../mod/findDefinitionOrFail.js" +import { type Mod } from "../mod/index.js" export function checkRuleNodeOrder( mod: Mod, diff --git a/src/lang/check/checkType.ts b/src/lang/check/checkType.ts index e01182ac..4e5e339c 100644 --- a/src/lang/check/checkType.ts +++ b/src/lang/check/checkType.ts @@ -1,11 +1,11 @@ -import { createChecking } from "../checking/createChecking" -import { collectWords } from "../compose/collectWords" -import { createEnv } from "../env/createEnv" -import { Mod } from "../mod" -import { Value } from "../value" -import { formatValue } from "../value/formatValue" -import { Word } from "../word" -import { checkAllLocalsAreUsed } from "./checkAllLocalsAreUsed" +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 { formatValue } from "../value/formatValue.js" +import { type Value } from "../value/index.js" +import { type Word } from "../word/index.js" +import { checkAllLocalsAreUsed } from "./checkAllLocalsAreUsed.js" export function checkType( mod: Mod, diff --git a/src/lang/check/checkTypeTermArgs.ts b/src/lang/check/checkTypeTermArgs.ts index 65e070be..2a7ca48a 100644 --- a/src/lang/check/checkTypeTermArgs.ts +++ b/src/lang/check/checkTypeTermArgs.ts @@ -1,5 +1,5 @@ -import { Value } from "../value" -import { formatValue } from "../value/formatValue" +import { formatValue } from "../value/formatValue.js" +import { type Value } from "../value/index.js" export function checkTypeTermArgs(args: Array): void { for (const arg of args) { diff --git a/src/lang/check/checkWords.ts b/src/lang/check/checkWords.ts index e58bb6c6..7ca70b98 100644 --- a/src/lang/check/checkWords.ts +++ b/src/lang/check/checkWords.ts @@ -1,14 +1,14 @@ -import { capType } from "../cap/capType" -import { createChecking } from "../checking/createChecking" -import { collectWords } from "../compose/collectWords" -import { compose } from "../compose/compose" -import { createEnv } from "../env/createEnv" -import { freshenType } from "../freshen/freshenType" -import { Mod } from "../mod" -import { unifyTypes } from "../unify/unifyTypes" -import { formatValue } from "../value/formatValue" -import { Word } from "../word" -import { checkAllLocalsAreUsed } from "./checkAllLocalsAreUsed" +import { capType } from "../cap/capType.js" +import { createChecking } from "../checking/createChecking.js" +import { collectWords } from "../compose/collectWords.js" +import { compose } from "../compose/compose.js" +import { createEnv } from "../env/createEnv.js" +import { freshenType } from "../freshen/freshenType.js" +import { type Mod } from "../mod/index.js" +import { unifyTypes } from "../unify/unifyTypes.js" +import { formatValue } from "../value/formatValue.js" +import { type Word } from "../word/index.js" +import { checkAllLocalsAreUsed } from "./checkAllLocalsAreUsed.js" export function checkWords( mod: Mod, diff --git a/src/lang/checking/Checking.ts b/src/lang/checking/Checking.ts index 1347b7f7..18617314 100644 --- a/src/lang/checking/Checking.ts +++ b/src/lang/checking/Checking.ts @@ -1,4 +1,4 @@ -import { Value } from "../value" +import { type Value } from "../value/index.js" export type Checking = { substitution: Map diff --git a/src/lang/checking/createChecking.ts b/src/lang/checking/createChecking.ts index 30e90d93..b59533c2 100644 --- a/src/lang/checking/createChecking.ts +++ b/src/lang/checking/createChecking.ts @@ -1,4 +1,4 @@ -import { Checking } from "./Checking" +import { type Checking } from "./Checking.js" export function createChecking(): Checking { return { diff --git a/src/lang/checking/index.ts b/src/lang/checking/index.ts index fdbd211b..25c01f3b 100644 --- a/src/lang/checking/index.ts +++ b/src/lang/checking/index.ts @@ -1 +1 @@ -export * from "./Checking" +export * from "./Checking.js" diff --git a/src/lang/compose/collectWords.ts b/src/lang/compose/collectWords.ts index 330eae37..2afe1396 100644 --- a/src/lang/compose/collectWords.ts +++ b/src/lang/compose/collectWords.ts @@ -1,9 +1,9 @@ -import { Env } from "../env" -import { Mod } from "../mod" -import { Value } from "../value" -import { Word } from "../word" -import { ComposeOptions } from "./compose" -import { composeWords } from "./composeWords" +import { type Env } from "../env/index.js" +import { type Mod } from "../mod/index.js" +import { type Value } from "../value/index.js" +import { type Word } from "../word/index.js" +import { type ComposeOptions } from "./compose.js" +import { composeWords } from "./composeWords.js" export function collectWords( mod: Mod, diff --git a/src/lang/compose/compose.ts b/src/lang/compose/compose.ts index c7694311..afbb6b2b 100644 --- a/src/lang/compose/compose.ts +++ b/src/lang/compose/compose.ts @@ -1,18 +1,18 @@ -import { Checking } from "../checking" -import { connect } from "../connect/connect" -import { Env } from "../env" -import { appendReport } from "../errors/appendReport" -import { Mod } from "../mod" -import { findDefinitionOrFail } from "../mod/findDefinitionOrFail" -import { disconnectPort } from "../net/disconnectPort" -import { findPortEntry } from "../net/findPortEntry" -import { Node } from "../node" -import { createNodeFromDefinition } from "../node/createNodeFromDefinition" -import { unifyTypes } from "../unify/unifyTypes" -import { Word } from "../word" -import { formatWord } from "../word/formatWord" -import { composeDefinition } from "./composeDefinition" -import { findCurrentPortOrFail } from "./findCurrentPortOrFail" +import { type Checking } from "../checking/index.js" +import { connect } from "../connect/connect.js" +import { type Env } from "../env/index.js" +import { appendReport } from "../errors/appendReport.js" +import { findDefinitionOrFail } from "../mod/findDefinitionOrFail.js" +import { type Mod } from "../mod/index.js" +import { disconnectPort } from "../net/disconnectPort.js" +import { findPortEntry } from "../net/findPortEntry.js" +import { createNodeFromDefinition } from "../node/createNodeFromDefinition.js" +import { type Node } from "../node/index.js" +import { unifyTypes } from "../unify/unifyTypes.js" +import { formatWord } from "../word/formatWord.js" +import { type Word } from "../word/index.js" +import { composeDefinition } from "./composeDefinition.js" +import { findCurrentPortOrFail } from "./findCurrentPortOrFail.js" export interface ComposeOptions { current?: { first: Node; second: Node } diff --git a/src/lang/compose/composeDefinition.ts b/src/lang/compose/composeDefinition.ts index 8f3903df..ffed605b 100644 --- a/src/lang/compose/composeDefinition.ts +++ b/src/lang/compose/composeDefinition.ts @@ -1,12 +1,12 @@ -import { arrayPopMany } from "../../utils/arrayPopMany" -import { checkTypeTermArgs } from "../check/checkTypeTermArgs" -import { Definition } from "../definition" -import { Env } from "../env" -import { createNodeFromDefinition } from "../node/createNodeFromDefinition" -import { formatValue } from "../value/formatValue" -import { ComposeOptions } from "./compose" -import { composeNode } from "./composeNode" -import { composeWords } from "./composeWords" +import { arrayPopMany } from "../../utils/arrayPopMany.js" +import { checkTypeTermArgs } from "../check/checkTypeTermArgs.js" +import { type Definition } from "../definition/index.js" +import { type Env } from "../env/index.js" +import { createNodeFromDefinition } from "../node/createNodeFromDefinition.js" +import { formatValue } from "../value/formatValue.js" +import { type ComposeOptions } from "./compose.js" +import { composeNode } from "./composeNode.js" +import { composeWords } from "./composeWords.js" export function composeDefinition( env: Env, diff --git a/src/lang/compose/composeNode.ts b/src/lang/compose/composeNode.ts index 36edd905..71a6bed7 100644 --- a/src/lang/compose/composeNode.ts +++ b/src/lang/compose/composeNode.ts @@ -1,11 +1,11 @@ -import { connect } from "../connect/connect" -import { Env } from "../env" -import { refreshNode } from "../freshen/refreshNode" -import { findInputPorts } from "../net/findInputPorts" -import { findOutputPorts } from "../net/findOutputPorts" -import { Node } from "../node" -import { unifyTypes } from "../unify/unifyTypes" -import { ComposeOptions } from "./compose" +import { connect } from "../connect/connect.js" +import { type Env } from "../env/index.js" +import { refreshNode } from "../freshen/refreshNode.js" +import { findInputPorts } from "../net/findInputPorts.js" +import { findOutputPorts } from "../net/findOutputPorts.js" +import { type Node } from "../node/index.js" +import { unifyTypes } from "../unify/unifyTypes.js" +import { type ComposeOptions } from "./compose.js" export function composeNode( env: Env, diff --git a/src/lang/compose/composeWords.ts b/src/lang/compose/composeWords.ts index f7cdbef9..79588863 100644 --- a/src/lang/compose/composeWords.ts +++ b/src/lang/compose/composeWords.ts @@ -1,7 +1,7 @@ -import { Env } from "../env" -import { Mod } from "../mod" -import { Word } from "../word" -import { ComposeOptions, compose } from "./compose" +import { type Env } from "../env/index.js" +import { type Mod } from "../mod/index.js" +import { type Word } from "../word/index.js" +import { compose, type ComposeOptions } from "./compose.js" export function composeWords( mod: Mod, diff --git a/src/lang/compose/findCurrentPortOrFail.ts b/src/lang/compose/findCurrentPortOrFail.ts index 464b83c8..da019a83 100644 --- a/src/lang/compose/findCurrentPortOrFail.ts +++ b/src/lang/compose/findCurrentPortOrFail.ts @@ -1,10 +1,10 @@ -import { Net } from "../net" -import { findInputPorts } from "../net/findInputPorts" -import { findOutputPorts } from "../net/findOutputPorts" -import { findPortEntry } from "../net/findPortEntry" -import { Node } from "../node" -import { Port } from "../port" -import { ComposeOptions } from "./compose" +import { findInputPorts } from "../net/findInputPorts.js" +import { findOutputPorts } from "../net/findOutputPorts.js" +import { findPortEntry } from "../net/findPortEntry.js" +import { type Net } from "../net/index.js" +import { type Node } from "../node/index.js" +import { type Port } from "../port/index.js" +import { type ComposeOptions } from "./compose.js" export function findCurrentPortOrFail( net: Net, diff --git a/src/lang/connect/connect.ts b/src/lang/connect/connect.ts index 63a93b51..cdb29e65 100644 --- a/src/lang/connect/connect.ts +++ b/src/lang/connect/connect.ts @@ -1,9 +1,9 @@ -import { checkPortSigns } from "../check/checkPortSigns" -import { Net } from "../net" -import { findPortEntry } from "../net/findPortEntry" -import { findPortRecordOrFail } from "../net/findPortRecordOrFail" -import { Port } from "../port" -import { formatValue } from "../value/formatValue" +import { checkPortSigns } from "../check/checkPortSigns.js" +import { findPortEntry } from "../net/findPortEntry.js" +import { findPortRecordOrFail } from "../net/findPortRecordOrFail.js" +import { type Net } from "../net/index.js" +import { type Port } from "../port/index.js" +import { formatValue } from "../value/formatValue.js" export function connect(net: Net, first: Port, second: Port): void { const firstPortEntry = findPortEntry(net, first) diff --git a/src/lang/definition/Definition.ts b/src/lang/definition/Definition.ts index 8553dd88..ae6d71ab 100644 --- a/src/lang/definition/Definition.ts +++ b/src/lang/definition/Definition.ts @@ -1,9 +1,9 @@ -import { ComposeOptions } from "../compose/compose" -import { Env } from "../env" -import { Mod } from "../mod" -import { PortExp } from "../port/PortExp" -import { Span } from "../span" -import { Word } from "../word" +import { type ComposeOptions } from "../compose/compose.js" +import { type Env } from "../env/index.js" +import { type Mod } from "../mod/index.js" +import { type PortExp } from "../port/PortExp.js" +import { type Span } from "../span/index.js" +import { type Word } from "../word/index.js" export type Definition = | NodeDefinition diff --git a/src/lang/definition/definitionMaybeSpan.ts b/src/lang/definition/definitionMaybeSpan.ts index 5c8a7a7e..22919a2b 100644 --- a/src/lang/definition/definitionMaybeSpan.ts +++ b/src/lang/definition/definitionMaybeSpan.ts @@ -1,5 +1,5 @@ -import { Span } from "../span" -import { Definition } from "./Definition" +import { type Span } from "../span/index.js" +import { type Definition } from "./Definition.js" export function definitionMaybeSpan(definition: Definition): Span | undefined { if (definition["@kind"] === "OperatorDefinition") { diff --git a/src/lang/definition/index.ts b/src/lang/definition/index.ts index 1d718c57..ff02f98a 100644 --- a/src/lang/definition/index.ts +++ b/src/lang/definition/index.ts @@ -1 +1 @@ -export * from "./Definition" +export * from "./Definition.js" diff --git a/src/lang/edge/Edge.ts b/src/lang/edge/Edge.ts index f4a1706c..002d2111 100644 --- a/src/lang/edge/Edge.ts +++ b/src/lang/edge/Edge.ts @@ -1,4 +1,4 @@ -import { Port } from "../port" +import { type Port } from "../port/index.js" export type Edge = { first: Port diff --git a/src/lang/edge/edgeEqual.ts b/src/lang/edge/edgeEqual.ts index e0f0bca0..3f45410f 100644 --- a/src/lang/edge/edgeEqual.ts +++ b/src/lang/edge/edgeEqual.ts @@ -1,5 +1,5 @@ -import { portEqual } from "../port/portEqual" -import { Edge } from "./Edge" +import { portEqual } from "../port/portEqual.js" +import { type Edge } from "./Edge.js" export function edgeEqual(x: Edge, y: Edge): boolean { return ( diff --git a/src/lang/edge/formatEdge.ts b/src/lang/edge/formatEdge.ts index 455da53f..375b4c15 100644 --- a/src/lang/edge/formatEdge.ts +++ b/src/lang/edge/formatEdge.ts @@ -1,5 +1,5 @@ -import { Edge } from "../edge" -import { formatNode } from "../node/formatNode" +import { type Edge } from "../edge/index.js" +import { formatNode } from "../node/formatNode.js" export function formatEdge(edge: Edge): string { const first = formatNode(edge.first.node) diff --git a/src/lang/edge/index.ts b/src/lang/edge/index.ts index ca21a165..5ab0f3fc 100644 --- a/src/lang/edge/index.ts +++ b/src/lang/edge/index.ts @@ -1,3 +1,3 @@ -export * from "./Edge" -export * from "./edgeEqual" -export * from "./formatEdge" +export * from "./Edge.js" +export * from "./edgeEqual.js" +export * from "./formatEdge.js" diff --git a/src/lang/env/Env.ts b/src/lang/env/Env.ts index ea1fd10e..6c8e6938 100644 --- a/src/lang/env/Env.ts +++ b/src/lang/env/Env.ts @@ -1,6 +1,6 @@ -import { Mod } from "../mod" -import { Net } from "../net" -import { Value } from "../value" +import { type Mod } from "../mod/index.js" +import { type Net } from "../net/index.js" +import { type Value } from "../value/index.js" export type Env = { mod: Mod diff --git a/src/lang/env/createEnv.ts b/src/lang/env/createEnv.ts index fb57c95c..6d8f0b2c 100644 --- a/src/lang/env/createEnv.ts +++ b/src/lang/env/createEnv.ts @@ -1,7 +1,7 @@ -import { Env } from "../env" -import { Mod } from "../mod" -import { Net } from "../net" -import { createNet } from "../net/createNet" +import { type Env } from "../env/index.js" +import { type Mod } from "../mod/index.js" +import { createNet } from "../net/createNet.js" +import { type Net } from "../net/index.js" export function createEnv( mod: Mod, diff --git a/src/lang/env/formatEnv.ts b/src/lang/env/formatEnv.ts index 60810b39..318c52a3 100644 --- a/src/lang/env/formatEnv.ts +++ b/src/lang/env/formatEnv.ts @@ -1,8 +1,8 @@ -import { indent } from "../../utils/indent" -import { formatNet } from "../net/formatNet" -import { netIsEmpty } from "../net/netIsEmpty" -import { formatValue } from "../value" -import { Env } from "./Env" +import { indent } from "../../utils/indent.js" +import { formatNet } from "../net/formatNet.js" +import { netIsEmpty } from "../net/netIsEmpty.js" +import { formatValue } from "../value/index.js" +import { type Env } from "./Env.js" export function formatEnv(env: Env): string { const netText = netIsEmpty(env.net) diff --git a/src/lang/env/index.ts b/src/lang/env/index.ts index 38aff7d8..c03a71e2 100644 --- a/src/lang/env/index.ts +++ b/src/lang/env/index.ts @@ -1,3 +1,3 @@ -export * from "./Env" -export * from "./createEnv" -export * from "./formatEnv" +export * from "./Env.js" +export * from "./createEnv.js" +export * from "./formatEnv.js" diff --git a/src/lang/errors/Report.ts b/src/lang/errors/Report.ts index bfe21eca..090c2020 100644 --- a/src/lang/errors/Report.ts +++ b/src/lang/errors/Report.ts @@ -1,5 +1,5 @@ import * as pt from "@cicada-lang/partech" -import { Span } from "../span" +import { type Span } from "../span/index.js" export type ReportEntry = { message: string diff --git a/src/lang/errors/appendReport.ts b/src/lang/errors/appendReport.ts index f222e3b9..183b2c52 100644 --- a/src/lang/errors/appendReport.ts +++ b/src/lang/errors/appendReport.ts @@ -1,5 +1,5 @@ -import { Report, ReportEntry } from "./Report" -import { createReportEntry } from "./createReportEntry" +import { Report, type ReportEntry } from "./Report.js" +import { createReportEntry } from "./createReportEntry.js" export function appendReport(error: unknown, entry: ReportEntry): Report { // NOTE We put the most recent report entry at the end, diff --git a/src/lang/errors/createReport.ts b/src/lang/errors/createReport.ts index 94932738..d8573da2 100644 --- a/src/lang/errors/createReport.ts +++ b/src/lang/errors/createReport.ts @@ -1,4 +1,4 @@ -import { Report, ReportEntry } from "./Report" +import { Report, type ReportEntry } from "./Report.js" export function createReport(entry: ReportEntry): Report { return new Report([entry]) diff --git a/src/lang/errors/createReportEntry.ts b/src/lang/errors/createReportEntry.ts index c4af776c..4a43190e 100644 --- a/src/lang/errors/createReportEntry.ts +++ b/src/lang/errors/createReportEntry.ts @@ -1,4 +1,4 @@ -import { ReportEntry } from "./Report" +import { type ReportEntry } from "./Report.js" export function createReportEntry(error: unknown): ReportEntry { if (error instanceof Error) { diff --git a/src/lang/errors/index.ts b/src/lang/errors/index.ts index 7c3911f7..270eaaed 100644 --- a/src/lang/errors/index.ts +++ b/src/lang/errors/index.ts @@ -1,4 +1,4 @@ -export * from "./ParsingError" -export * from "./Report" -export * from "./appendReport" -export * from "./createReport" +export * from "./ParsingError.js" +export * from "./Report.js" +export * from "./appendReport.js" +export * from "./createReport.js" diff --git a/src/lang/freshen/freshenType.ts b/src/lang/freshen/freshenType.ts index 34dbb3fa..d19a89ff 100644 --- a/src/lang/freshen/freshenType.ts +++ b/src/lang/freshen/freshenType.ts @@ -1,5 +1,5 @@ -import { stringToSubscript } from "../../utils/stringToSubscript" -import { Value } from "../value" +import { stringToSubscript } from "../../utils/stringToSubscript.js" +import { type Value } from "../value/index.js" export function freshenType( typeVarCounters: Map, diff --git a/src/lang/freshen/refreshNode.ts b/src/lang/freshen/refreshNode.ts index d72fe9af..63707470 100644 --- a/src/lang/freshen/refreshNode.ts +++ b/src/lang/freshen/refreshNode.ts @@ -1,7 +1,7 @@ -import { Net } from "../net" -import { findPortRecordOrFail } from "../net/findPortRecordOrFail" -import { Node } from "../node" -import { freshenType } from "./freshenType" +import { findPortRecordOrFail } from "../net/findPortRecordOrFail.js" +import { type Net } from "../net/index.js" +import { type Node } from "../node/index.js" +import { freshenType } from "./freshenType.js" /* diff --git a/src/lang/import/formatImportBinding.ts b/src/lang/import/formatImportBinding.ts index 02cb782b..cdcb2ff7 100644 --- a/src/lang/import/formatImportBinding.ts +++ b/src/lang/import/formatImportBinding.ts @@ -1,4 +1,4 @@ -import { ImportBinding } from "./ImportBinding" +import { type ImportBinding } from "./ImportBinding.js" export function formatImportBinding(binding: ImportBinding): string { if (binding.alias) { diff --git a/src/lang/import/importAll.ts b/src/lang/import/importAll.ts index 1b1caf62..da2601a7 100644 --- a/src/lang/import/importAll.ts +++ b/src/lang/import/importAll.ts @@ -1,4 +1,4 @@ -import { Mod } from "../mod" +import { type Mod } from "../mod/index.js" export function importAll(mod: Mod, targetMod: Mod): void { for (const [name, definition] of targetMod.definitions) { diff --git a/src/lang/import/importMany.ts b/src/lang/import/importMany.ts index 1dd09fce..27d98119 100644 --- a/src/lang/import/importMany.ts +++ b/src/lang/import/importMany.ts @@ -1,6 +1,6 @@ -import { Mod } from "../mod" -import { ImportBinding } from "./ImportBinding" -import { importOne } from "./importOne" +import { type Mod } from "../mod/index.js" +import { type ImportBinding } from "./ImportBinding.js" +import { importOne } from "./importOne.js" export function importMany( mod: Mod, diff --git a/src/lang/import/importNodeRules.ts b/src/lang/import/importNodeRules.ts index 1ce104ef..49ebac85 100644 --- a/src/lang/import/importNodeRules.ts +++ b/src/lang/import/importNodeRules.ts @@ -1,5 +1,5 @@ -import { Mod } from "../mod" -import { NodeWithoutId, nodeKeyWithoutId } from "../node" +import { type Mod } from "../mod/index.js" +import { nodeKeyWithoutId, type NodeWithoutId } from "../node/index.js" export function importNodeRules( mod: Mod, diff --git a/src/lang/import/importOne.ts b/src/lang/import/importOne.ts index 3329b92b..a68b18c9 100644 --- a/src/lang/import/importOne.ts +++ b/src/lang/import/importOne.ts @@ -1,6 +1,6 @@ -import { Mod } from "../mod" -import { ImportBinding } from "./ImportBinding" -import { importNodeRules } from "./importNodeRules" +import { type Mod } from "../mod/index.js" +import { type ImportBinding } from "./ImportBinding.js" +import { importNodeRules } from "./importNodeRules.js" export function importOne( mod: Mod, diff --git a/src/lang/interact/index.ts b/src/lang/interact/index.ts index 0c1d2c51..531ad8a9 100644 --- a/src/lang/interact/index.ts +++ b/src/lang/interact/index.ts @@ -1 +1 @@ -export * from "./interact" +export * from "./interact.js" diff --git a/src/lang/interact/interact.ts b/src/lang/interact/interact.ts index d5adf533..97205813 100644 --- a/src/lang/interact/interact.ts +++ b/src/lang/interact/interact.ts @@ -1,9 +1,9 @@ -import { Checking } from "../checking" -import { compose } from "../compose/compose" -import { Edge } from "../edge" -import { Env } from "../env" -import { findRuleByPorts } from "../mod/findRuleByPorts" -import { deleteNodeEntry } from "../net/deleteNodeEntry" +import { type Checking } from "../checking/index.js" +import { compose } from "../compose/compose.js" +import { type Edge } from "../edge/index.js" +import { type Env } from "../env/index.js" +import { findRuleByPorts } from "../mod/findRuleByPorts.js" +import { deleteNodeEntry } from "../net/deleteNodeEntry.js" export type InteractOptions = { checking?: Checking diff --git a/src/lang/mod/Mod.ts b/src/lang/mod/Mod.ts index 09ae0855..cff688b9 100644 --- a/src/lang/mod/Mod.ts +++ b/src/lang/mod/Mod.ts @@ -1,9 +1,9 @@ -import { Loader } from "../../loader" -import { Checking } from "../checking" -import { Definition } from "../definition" -import { Env } from "../env/Env.js" -import { Stmt } from "../stmt/Stmt.js" -import { RuleEntry } from "./RuleEntry" +import { Loader } from "../../loader/index.js" +import { type Checking } from "../checking/index.js" +import { type Definition } from "../definition/index.js" +import { type Env } from "../env/Env.js" +import { type Stmt } from "../stmt/Stmt.js" +import { type RuleEntry } from "./RuleEntry.js" export type Mod = { loader: Loader diff --git a/src/lang/mod/RuleEntry.ts b/src/lang/mod/RuleEntry.ts index 87c7b4d6..3413ff2a 100644 --- a/src/lang/mod/RuleEntry.ts +++ b/src/lang/mod/RuleEntry.ts @@ -1,6 +1,6 @@ -import { NodeWithoutId } from "../node" -import { Word } from "../word" -import { Mod } from "./Mod" +import { type NodeWithoutId } from "../node/index.js" +import { type Word } from "../word/index.js" +import { type Mod } from "./Mod.js" export type RuleEntry = { name: string diff --git a/src/lang/mod/createMod.ts b/src/lang/mod/createMod.ts index f4a58d34..e0b63d21 100644 --- a/src/lang/mod/createMod.ts +++ b/src/lang/mod/createMod.ts @@ -1,9 +1,9 @@ -import { Loader } from "../../loader" -import { defineBuiltinOperators } from "../builtins/defineBuiltinOperators" -import { createChecking } from "../checking/createChecking" +import { Loader } from "../../loader/index.js" +import { defineBuiltinOperators } from "../builtins/defineBuiltinOperators.js" +import { createChecking } from "../checking/createChecking.js" import { createEnv } from "../env/createEnv.js" -import { Stmt } from "../stmt/Stmt.js" -import { Mod } from "./Mod" +import { type Stmt } from "../stmt/Stmt.js" +import { type Mod } from "./Mod.js" export function createMod(options: { url: URL diff --git a/src/lang/mod/define.ts b/src/lang/mod/define.ts index ce008b22..1edca734 100644 --- a/src/lang/mod/define.ts +++ b/src/lang/mod/define.ts @@ -1,5 +1,5 @@ -import { Definition } from "../definition" -import { Mod } from "./Mod" +import { type Definition } from "../definition/index.js" +import { type Mod } from "./Mod.js" export function define(mod: Mod, name: string, definition: Definition): void { const found = mod.definitions.get(name) diff --git a/src/lang/mod/defineRule.ts b/src/lang/mod/defineRule.ts index a94da1a8..ca25701b 100644 --- a/src/lang/mod/defineRule.ts +++ b/src/lang/mod/defineRule.ts @@ -1,7 +1,7 @@ -import { nodeKeyWithoutId } from "../node/nodeKeyWithoutId" -import { Word } from "../word" -import { Mod } from "./Mod" -import { findDefinitionOrFail } from "./findDefinitionOrFail" +import { nodeKeyWithoutId } from "../node/nodeKeyWithoutId.js" +import { type Word } from "../word/index.js" +import { type Mod } from "./Mod.js" +import { findDefinitionOrFail } from "./findDefinitionOrFail.js" export function defineRule( mod: Mod, diff --git a/src/lang/mod/findDefinition.ts b/src/lang/mod/findDefinition.ts index d4a792eb..2086d1f8 100644 --- a/src/lang/mod/findDefinition.ts +++ b/src/lang/mod/findDefinition.ts @@ -1,5 +1,5 @@ -import { Definition } from "../definition" -import { Mod } from "./Mod" +import { type Definition } from "../definition/index.js" +import { type Mod } from "./Mod.js" export function findDefinition(mod: Mod, name: string): Definition | undefined { return mod.definitions.get(name) diff --git a/src/lang/mod/findDefinitionOrFail.ts b/src/lang/mod/findDefinitionOrFail.ts index b4bd2f0d..5a7c52a8 100644 --- a/src/lang/mod/findDefinitionOrFail.ts +++ b/src/lang/mod/findDefinitionOrFail.ts @@ -1,5 +1,5 @@ -import { Definition } from "../definition" -import { Mod } from "./Mod" +import { type Definition } from "../definition/index.js" +import { type Mod } from "./Mod.js" export function findDefinitionOrFail(mod: Mod, name: string): Definition { const definition = mod.definitions.get(name) diff --git a/src/lang/mod/findNodeRuleEntries.ts b/src/lang/mod/findNodeRuleEntries.ts index 557dda51..0acb6b41 100644 --- a/src/lang/mod/findNodeRuleEntries.ts +++ b/src/lang/mod/findNodeRuleEntries.ts @@ -1,8 +1,8 @@ -import { NodeWithoutId } from "../node" -import { nodeKeyWithoutId } from "../node/nodeKeyWithoutId" -import { Mod } from "./Mod" -import { RuleEntry } from "./RuleEntry" -import { hasNodeDefinition } from "./hasNodeDefinition" +import { type NodeWithoutId } from "../node/index.js" +import { nodeKeyWithoutId } from "../node/nodeKeyWithoutId.js" +import { type Mod } from "./Mod.js" +import { type RuleEntry } from "./RuleEntry.js" +import { hasNodeDefinition } from "./hasNodeDefinition.js" export function findNodeRuleEntries( mod: Mod, diff --git a/src/lang/mod/findRuleByName.ts b/src/lang/mod/findRuleByName.ts index 0f3f156c..24f89e9f 100644 --- a/src/lang/mod/findRuleByName.ts +++ b/src/lang/mod/findRuleByName.ts @@ -1,7 +1,7 @@ -import { Rule } from "../rule" -import { Mod } from "./Mod" -import { findDefinitionOrFail } from "./findDefinitionOrFail" -import { findRuleByNodes } from "./findRuleByNodes" +import { type Rule } from "../rule/index.js" +import { type Mod } from "./Mod.js" +import { findDefinitionOrFail } from "./findDefinitionOrFail.js" +import { findRuleByNodes } from "./findRuleByNodes.js" export function findRuleByName(mod: Mod, ruleName: string): Rule | undefined { const [firstName, secondName] = ruleName.split(" ") diff --git a/src/lang/mod/findRuleByNodes.ts b/src/lang/mod/findRuleByNodes.ts index 6690e388..6c871706 100644 --- a/src/lang/mod/findRuleByNodes.ts +++ b/src/lang/mod/findRuleByNodes.ts @@ -1,7 +1,7 @@ -import { NodeWithoutId } from "../node/Node" -import { nodeKeyWithoutId } from "../node/nodeKeyWithoutId" -import { Rule } from "../rule" -import { Mod } from "./Mod" +import { type NodeWithoutId } from "../node/Node.js" +import { nodeKeyWithoutId } from "../node/nodeKeyWithoutId.js" +import { type Rule } from "../rule/index.js" +import { type Mod } from "./Mod.js" export function findRuleByNodes( mod: Mod, diff --git a/src/lang/mod/findRuleByPorts.ts b/src/lang/mod/findRuleByPorts.ts index 8cd184c2..0fdcebd2 100644 --- a/src/lang/mod/findRuleByPorts.ts +++ b/src/lang/mod/findRuleByPorts.ts @@ -1,7 +1,7 @@ -import { Port } from "../port" -import { Rule } from "../rule" -import { Mod } from "./Mod" -import { findRuleByNodes } from "./findRuleByNodes" +import { type Port } from "../port/index.js" +import { type Rule } from "../rule/index.js" +import { type Mod } from "./Mod.js" +import { findRuleByNodes } from "./findRuleByNodes.js" export function findRuleByPorts( mod: Mod, diff --git a/src/lang/mod/hasNodeDefinition.ts b/src/lang/mod/hasNodeDefinition.ts index 31808832..f2231f95 100644 --- a/src/lang/mod/hasNodeDefinition.ts +++ b/src/lang/mod/hasNodeDefinition.ts @@ -1,6 +1,6 @@ -import { NodeWithoutId } from "../node" -import { Mod } from "./Mod" -import { findDefinition } from "./findDefinition" +import { type NodeWithoutId } from "../node/index.js" +import { type Mod } from "./Mod.js" +import { findDefinition } from "./findDefinition.js" export function hasNodeDefinition(mod: Mod, node: NodeWithoutId): boolean { const definition = findDefinition(mod, node.name) diff --git a/src/lang/mod/index.ts b/src/lang/mod/index.ts index 827f4c13..67b17668 100644 --- a/src/lang/mod/index.ts +++ b/src/lang/mod/index.ts @@ -1,11 +1,11 @@ -export * from "./Mod" -export * from "./RuleEntry" -export * from "./createMod" -export * from "./define" -export * from "./defineRule" -export * from "./findDefinition" -export * from "./findDefinitionOrFail" -export * from "./findNodeRuleEntries" -export * from "./findRuleByName" -export * from "./findRuleByNodes" -export * from "./findRuleByPorts" +export * from "./Mod.js" +export * from "./RuleEntry.js" +export * from "./createMod.js" +export * from "./define.js" +export * from "./defineRule.js" +export * from "./findDefinition.js" +export * from "./findDefinitionOrFail.js" +export * from "./findNodeRuleEntries.js" +export * from "./findRuleByName.js" +export * from "./findRuleByNodes.js" +export * from "./findRuleByPorts.js" diff --git a/src/lang/net/Net.ts b/src/lang/net/Net.ts index 38d2f5c1..983bb7f5 100644 --- a/src/lang/net/Net.ts +++ b/src/lang/net/Net.ts @@ -1,7 +1,7 @@ -import { Edge } from "../edge" -import { Port } from "../port" -import { Sign } from "../sign" -import { Value } from "../value" +import { type Edge } from "../edge/index.js" +import { type Port } from "../port/index.js" +import { type Sign } from "../sign/index.js" +import { type Value } from "../value/index.js" /* diff --git a/src/lang/net/addNode.ts b/src/lang/net/addNode.ts index fc2e21f6..e1a797c7 100644 --- a/src/lang/net/addNode.ts +++ b/src/lang/net/addNode.ts @@ -1,9 +1,9 @@ -import { Mod } from "../mod" -import { Net, PortRecord } from "../net" -import { Node } from "../node" -import { createNodeId } from "../node/createNodeId" -import { nodeKey } from "../node/nodeKey" -import { PortExp } from "../port/PortExp" +import { type Mod } from "../mod/index.js" +import { type Net, type PortRecord } from "../net/index.js" +import { createNodeId } from "../node/createNodeId.js" +import { type Node } from "../node/index.js" +import { nodeKey } from "../node/nodeKey.js" +import { type PortExp } from "../port/PortExp.js" export function addNode( net: Net, diff --git a/src/lang/net/allEdges.ts b/src/lang/net/allEdges.ts index 8bdacf33..b6a9269f 100644 --- a/src/lang/net/allEdges.ts +++ b/src/lang/net/allEdges.ts @@ -1,9 +1,9 @@ -import { Edge } from "../edge" -import { nodeKey } from "../node/nodeKey" -import { Port } from "../port" -import { Net } from "./Net" -import { createNodeFromNodeEntry } from "./createNodeFromNodeEntry" -import { createPortFromPortEntry } from "./createPortFromPortEntry" +import { type Edge } from "../edge/index.js" +import { nodeKey } from "../node/nodeKey.js" +import { type Port } from "../port/index.js" +import { type Net } from "./Net.js" +import { createNodeFromNodeEntry } from "./createNodeFromNodeEntry.js" +import { createPortFromPortEntry } from "./createPortFromPortEntry.js" export function allEdges(net: Net): Array { const edges: Array = [] diff --git a/src/lang/net/cloneNodeEntry.ts b/src/lang/net/cloneNodeEntry.ts index 779f9548..371a1e00 100644 --- a/src/lang/net/cloneNodeEntry.ts +++ b/src/lang/net/cloneNodeEntry.ts @@ -1,5 +1,5 @@ -import { NodeEntry } from "./Net" -import { clonePortRecord } from "./clonePortRecord" +import { type NodeEntry } from "./Net.js" +import { clonePortRecord } from "./clonePortRecord.js" export function cloneNodeEntry(entry: NodeEntry): NodeEntry { return { ...entry, ports: clonePortRecord(entry.ports) } diff --git a/src/lang/net/clonePortEntry.ts b/src/lang/net/clonePortEntry.ts index 3c67b352..dbacb55a 100644 --- a/src/lang/net/clonePortEntry.ts +++ b/src/lang/net/clonePortEntry.ts @@ -1,4 +1,4 @@ -import { PortEntry } from "./Net" +import { type PortEntry } from "./Net.js" export function clonePortEntry(entry: PortEntry): PortEntry { return { diff --git a/src/lang/net/clonePortRecord.ts b/src/lang/net/clonePortRecord.ts index 7294c745..92f16e00 100644 --- a/src/lang/net/clonePortRecord.ts +++ b/src/lang/net/clonePortRecord.ts @@ -1,5 +1,5 @@ -import { PortRecord } from "./Net" -import { clonePortEntry } from "./clonePortEntry" +import { type PortRecord } from "./Net.js" +import { clonePortEntry } from "./clonePortEntry.js" export function clonePortRecord(record: PortRecord): PortRecord { return Object.fromEntries( diff --git a/src/lang/net/copyConnectedComponent.ts b/src/lang/net/copyConnectedComponent.ts index 7a34c6a6..109b26a2 100644 --- a/src/lang/net/copyConnectedComponent.ts +++ b/src/lang/net/copyConnectedComponent.ts @@ -1,9 +1,9 @@ -import { edgeEqual } from "../edge/edgeEqual" -import { Node } from "../node" -import { Net } from "./Net" -import { copyNode } from "./copyNode" -import { findPortRecordOrFail } from "./findPortRecordOrFail" -import { hasNode } from "./hasNode" +import { edgeEqual } from "../edge/edgeEqual.js" +import { type Node } from "../node/index.js" +import { type Net } from "./Net.js" +import { copyNode } from "./copyNode.js" +import { findPortRecordOrFail } from "./findPortRecordOrFail.js" +import { hasNode } from "./hasNode.js" export function copyConnectedComponent( net: Net, diff --git a/src/lang/net/copyNode.ts b/src/lang/net/copyNode.ts index 47c108a9..c38718a7 100644 --- a/src/lang/net/copyNode.ts +++ b/src/lang/net/copyNode.ts @@ -1,8 +1,8 @@ -import { Node } from "../node" -import { nodeKey } from "../node/nodeKey" -import { Net } from "./Net" -import { cloneNodeEntry } from "./cloneNodeEntry" -import { findNodeEntryOrFail } from "./findNodeEntryOrFail" +import { type Node } from "../node/index.js" +import { nodeKey } from "../node/nodeKey.js" +import { type Net } from "./Net.js" +import { cloneNodeEntry } from "./cloneNodeEntry.js" +import { findNodeEntryOrFail } from "./findNodeEntryOrFail.js" export function copyNode(source: Net, target: Net, node: Node): void { const entry = findNodeEntryOrFail(source, node) diff --git a/src/lang/net/createNet.ts b/src/lang/net/createNet.ts index fd416de3..47368c2a 100644 --- a/src/lang/net/createNet.ts +++ b/src/lang/net/createNet.ts @@ -1,4 +1,4 @@ -import { Net } from "./Net" +import { type Net } from "./Net.js" export function createNet(): Net { return { diff --git a/src/lang/net/createNodeFromNodeEntry.ts b/src/lang/net/createNodeFromNodeEntry.ts index 58e3feed..772a2196 100644 --- a/src/lang/net/createNodeFromNodeEntry.ts +++ b/src/lang/net/createNodeFromNodeEntry.ts @@ -1,5 +1,5 @@ -import { Node } from "../node" -import { NodeEntry } from "./Net" +import { type Node } from "../node/index.js" +import { type NodeEntry } from "./Net.js" export function createNodeFromNodeEntry(nodeEntry: NodeEntry): Node { return { diff --git a/src/lang/net/createPortFromPortEntry.ts b/src/lang/net/createPortFromPortEntry.ts index b5236a25..aa56fed0 100644 --- a/src/lang/net/createPortFromPortEntry.ts +++ b/src/lang/net/createPortFromPortEntry.ts @@ -1,6 +1,6 @@ -import { Node } from "../node" -import { Port } from "../port" -import { PortEntry } from "./Net" +import { type Node } from "../node/index.js" +import { type Port } from "../port/index.js" +import { type PortEntry } from "./Net.js" export function createPortFromPortEntry( node: Node, diff --git a/src/lang/net/deleteNodeEntry.ts b/src/lang/net/deleteNodeEntry.ts index 531204a0..241e6ae8 100644 --- a/src/lang/net/deleteNodeEntry.ts +++ b/src/lang/net/deleteNodeEntry.ts @@ -1,6 +1,6 @@ -import { Node } from "../node" -import { nodeKey } from "../node/nodeKey" -import { Net } from "./Net" +import { type Node } from "../node/index.js" +import { nodeKey } from "../node/nodeKey.js" +import { type Net } from "./Net.js" export function deleteNodeEntry(net: Net, node: Node): void { net.nodeEntries.delete(nodeKey(node)) diff --git a/src/lang/net/disconnectPort.ts b/src/lang/net/disconnectPort.ts index 96c4b7ae..5c6950c3 100644 --- a/src/lang/net/disconnectPort.ts +++ b/src/lang/net/disconnectPort.ts @@ -1,6 +1,6 @@ -import { Port } from "../port" -import { Net } from "./Net" -import { findNodeEntry } from "./findNodeEntry" +import { type Port } from "../port/index.js" +import { type Net } from "./Net.js" +import { findNodeEntry } from "./findNodeEntry.js" export function disconnectPort(net: Net, port: Port): Port | undefined { const nodeEntry = findNodeEntry(net, port.node) diff --git a/src/lang/net/findConnectedComponent.ts b/src/lang/net/findConnectedComponent.ts index b386d1e7..5a9c1171 100644 --- a/src/lang/net/findConnectedComponent.ts +++ b/src/lang/net/findConnectedComponent.ts @@ -1,7 +1,7 @@ -import { Node } from "../node" -import { Net } from "./Net" -import { copyConnectedComponent } from "./copyConnectedComponent" -import { createNet } from "./createNet" +import { type Node } from "../node/index.js" +import { type Net } from "./Net.js" +import { copyConnectedComponent } from "./copyConnectedComponent.js" +import { createNet } from "./createNet.js" export function findConnectedComponent(net: Net, node: Node): Net { const component = createNet() diff --git a/src/lang/net/findInputPorts.ts b/src/lang/net/findInputPorts.ts index 8c04a271..bd5630a8 100644 --- a/src/lang/net/findInputPorts.ts +++ b/src/lang/net/findInputPorts.ts @@ -1,8 +1,8 @@ -import { Node } from "../node" -import { Port } from "../port" -import { Net } from "./Net" -import { createPortFromPortEntry } from "./createPortFromPortEntry" -import { findPortRecordOrFail } from "./findPortRecordOrFail" +import { type Node } from "../node/index.js" +import { type Port } from "../port/index.js" +import { type Net } from "./Net.js" +import { createPortFromPortEntry } from "./createPortFromPortEntry.js" +import { findPortRecordOrFail } from "./findPortRecordOrFail.js" export function findInputPorts(net: Net, node: Node): Array { const portRecord = findPortRecordOrFail(net, node) diff --git a/src/lang/net/findNodeEntry.ts b/src/lang/net/findNodeEntry.ts index 2f499f46..50e18d52 100644 --- a/src/lang/net/findNodeEntry.ts +++ b/src/lang/net/findNodeEntry.ts @@ -1,6 +1,6 @@ -import { Node } from "../node" -import { nodeKey } from "../node/nodeKey" -import { Net, NodeEntry } from "./Net" +import { type Node } from "../node/index.js" +import { nodeKey } from "../node/nodeKey.js" +import { type Net, type NodeEntry } from "./Net.js" export function findNodeEntry(net: Net, node: Node): NodeEntry | undefined { return net.nodeEntries.get(nodeKey(node)) diff --git a/src/lang/net/findNodeEntryOrFail.ts b/src/lang/net/findNodeEntryOrFail.ts index a0dd8fd0..03f33bfa 100644 --- a/src/lang/net/findNodeEntryOrFail.ts +++ b/src/lang/net/findNodeEntryOrFail.ts @@ -1,7 +1,7 @@ -import { Node } from "../node" -import { formatNode } from "../node/formatNode" -import { nodeKey } from "../node/nodeKey" -import { Net, NodeEntry } from "./Net" +import { formatNode } from "../node/formatNode.js" +import { type Node } from "../node/index.js" +import { nodeKey } from "../node/nodeKey.js" +import { type Net, type NodeEntry } from "./Net.js" export function findNodeEntryOrFail(net: Net, node: Node): NodeEntry { const nodeEntry = net.nodeEntries.get(nodeKey(node)) diff --git a/src/lang/net/findOutputPorts.ts b/src/lang/net/findOutputPorts.ts index 9572d7ef..fecbd98f 100644 --- a/src/lang/net/findOutputPorts.ts +++ b/src/lang/net/findOutputPorts.ts @@ -1,8 +1,8 @@ -import { Node } from "../node" -import { Port } from "../port" -import { Net } from "./Net" -import { createPortFromPortEntry } from "./createPortFromPortEntry" -import { findPortRecordOrFail } from "./findPortRecordOrFail" +import { type Node } from "../node/index.js" +import { type Port } from "../port/index.js" +import { type Net } from "./Net.js" +import { createPortFromPortEntry } from "./createPortFromPortEntry.js" +import { findPortRecordOrFail } from "./findPortRecordOrFail.js" export function findOutputPorts(net: Net, node: Node): Array { const portRecord = findPortRecordOrFail(net, node) diff --git a/src/lang/net/findPortEntry.ts b/src/lang/net/findPortEntry.ts index 7d9f37fd..785e8be1 100644 --- a/src/lang/net/findPortEntry.ts +++ b/src/lang/net/findPortEntry.ts @@ -1,6 +1,6 @@ -import { Port } from "../port" -import { Net, PortEntry } from "./Net" -import { findNodeEntry } from "./findNodeEntry" +import { type Port } from "../port/index.js" +import { type Net, type PortEntry } from "./Net.js" +import { findNodeEntry } from "./findNodeEntry.js" export function findPortEntry(net: Net, port: Port): PortEntry | undefined { const nodeEntry = findNodeEntry(net, port.node) diff --git a/src/lang/net/findPortRecord.ts b/src/lang/net/findPortRecord.ts index 2e5ced64..1aed46c9 100644 --- a/src/lang/net/findPortRecord.ts +++ b/src/lang/net/findPortRecord.ts @@ -1,6 +1,6 @@ -import { Node } from "../node" -import { Net, PortRecord } from "./Net" -import { findNodeEntry } from "./findNodeEntry" +import { type Node } from "../node/index.js" +import { type Net, type PortRecord } from "./Net.js" +import { findNodeEntry } from "./findNodeEntry.js" export function findPortRecord(net: Net, node: Node): PortRecord | undefined { const nodeEntry = findNodeEntry(net, node) diff --git a/src/lang/net/findPortRecordOrFail.ts b/src/lang/net/findPortRecordOrFail.ts index c8356d6c..edd5b66e 100644 --- a/src/lang/net/findPortRecordOrFail.ts +++ b/src/lang/net/findPortRecordOrFail.ts @@ -1,7 +1,7 @@ -import { Node } from "../node" -import { formatNode } from "../node/formatNode" -import { Net, PortRecord } from "./Net" -import { findNodeEntry } from "./findNodeEntry" +import { formatNode } from "../node/formatNode.js" +import { type Node } from "../node/index.js" +import { type Net, type PortRecord } from "./Net.js" +import { findNodeEntry } from "./findNodeEntry.js" export function findPortRecordOrFail(net: Net, node: Node): PortRecord { const nodeEntry = findNodeEntry(net, node) diff --git a/src/lang/net/findPrincipalPort.ts b/src/lang/net/findPrincipalPort.ts index 437d4d6c..c50a2c8c 100644 --- a/src/lang/net/findPrincipalPort.ts +++ b/src/lang/net/findPrincipalPort.ts @@ -1,8 +1,8 @@ -import { Node, formatNode } from "../node" -import { Port } from "../port" -import { Net } from "./Net" -import { createPortFromPortEntry } from "./createPortFromPortEntry" -import { findPortRecordOrFail } from "./findPortRecordOrFail" +import { formatNode, type Node } from "../node/index.js" +import { type Port } from "../port/index.js" +import { type Net } from "./Net.js" +import { createPortFromPortEntry } from "./createPortFromPortEntry.js" +import { findPortRecordOrFail } from "./findPortRecordOrFail.js" export function findPrincipalPort(net: Net, node: Node): Port { const portRecord = findPortRecordOrFail(net, node) diff --git a/src/lang/net/formatNet.ts b/src/lang/net/formatNet.ts index a931c0a5..dacc9819 100644 --- a/src/lang/net/formatNet.ts +++ b/src/lang/net/formatNet.ts @@ -1,6 +1,6 @@ -import { formatEdge } from "../edge/formatEdge" -import { Net } from "./Net" -import { allEdges } from "./allEdges" +import { formatEdge } from "../edge/formatEdge.js" +import { type Net } from "./Net.js" +import { allEdges } from "./allEdges.js" export function formatNet(net: Net): string { return allEdges(net).map(formatEdge).join("\n") diff --git a/src/lang/net/hasNode.ts b/src/lang/net/hasNode.ts index 8fe42c66..c4f7da5a 100644 --- a/src/lang/net/hasNode.ts +++ b/src/lang/net/hasNode.ts @@ -1,6 +1,6 @@ -import { Node } from "../node" -import { Net } from "./Net" -import { findPortRecord } from "./findPortRecord" +import { type Node } from "../node/index.js" +import { type Net } from "./Net.js" +import { findPortRecord } from "./findPortRecord.js" export function hasNode(net: Net, node: Node): boolean { return Boolean(findPortRecord(net, node)) diff --git a/src/lang/net/index.ts b/src/lang/net/index.ts index 85ea43d3..54b66f87 100644 --- a/src/lang/net/index.ts +++ b/src/lang/net/index.ts @@ -1,4 +1,4 @@ -export * from "./Net" -export * from "./allEdges" -export * from "./copyConnectedComponent" -export * from "./createNet" +export * from "./Net.js" +export * from "./allEdges.js" +export * from "./copyConnectedComponent.js" +export * from "./createNet.js" diff --git a/src/lang/net/moveConnectedComponent.ts b/src/lang/net/moveConnectedComponent.ts index 9c1943cc..cdfb10da 100644 --- a/src/lang/net/moveConnectedComponent.ts +++ b/src/lang/net/moveConnectedComponent.ts @@ -1,10 +1,10 @@ -import { Edge } from "../edge" -import { edgeEqual } from "../edge/edgeEqual" -import { Node } from "../node" -import { Net } from "./Net" -import { findPortRecordOrFail } from "./findPortRecordOrFail" -import { hasNode } from "./hasNode" -import { moveNode } from "./moveNode" +import { edgeEqual } from "../edge/edgeEqual.js" +import { type Edge } from "../edge/index.js" +import { type Node } from "../node/index.js" +import { type Net } from "./Net.js" +import { findPortRecordOrFail } from "./findPortRecordOrFail.js" +import { hasNode } from "./hasNode.js" +import { moveNode } from "./moveNode.js" export function moveConnectedComponent( net: Net, diff --git a/src/lang/net/moveNode.ts b/src/lang/net/moveNode.ts index 4f66a096..6a3e9e47 100644 --- a/src/lang/net/moveNode.ts +++ b/src/lang/net/moveNode.ts @@ -1,7 +1,7 @@ -import { Node } from "../node" -import { nodeKey } from "../node/nodeKey" -import { Net } from "./Net" -import { findNodeEntryOrFail } from "./findNodeEntryOrFail" +import { type Node } from "../node/index.js" +import { nodeKey } from "../node/nodeKey.js" +import { type Net } from "./Net.js" +import { findNodeEntryOrFail } from "./findNodeEntryOrFail.js" export function moveNode(source: Net, target: Net, node: Node): void { const entry = findNodeEntryOrFail(source, node) diff --git a/src/lang/net/netIsEmpty.ts b/src/lang/net/netIsEmpty.ts index 6cc5cf09..cab662ed 100644 --- a/src/lang/net/netIsEmpty.ts +++ b/src/lang/net/netIsEmpty.ts @@ -1,4 +1,4 @@ -import { Net } from "./Net" +import { type Net } from "./Net.js" export function netIsEmpty(net: Net): boolean { return net.activeEdges.length === 0 && net.nodeEntries.size === 0 diff --git a/src/lang/node/createNodeFromDefinition.ts b/src/lang/node/createNodeFromDefinition.ts index 69b34cec..87d25f93 100644 --- a/src/lang/node/createNodeFromDefinition.ts +++ b/src/lang/node/createNodeFromDefinition.ts @@ -1,7 +1,7 @@ -import { Definition } from "../definition" -import { Net } from "../net" -import { addNode } from "../net/addNode" -import { Node } from "../node" +import { type Definition } from "../definition/index.js" +import { addNode } from "../net/addNode.js" +import { type Net } from "../net/index.js" +import { type Node } from "../node/index.js" export function createNodeFromDefinition( net: Net, diff --git a/src/lang/node/createNodeId.ts b/src/lang/node/createNodeId.ts index 648be931..8381546c 100644 --- a/src/lang/node/createNodeId.ts +++ b/src/lang/node/createNodeId.ts @@ -1,5 +1,5 @@ -import { Mod } from "../mod" -import { globalNodeCounters } from "./globalNodeCounters" +import { type Mod } from "../mod/index.js" +import { globalNodeCounters } from "./globalNodeCounters.js" export function createNodeId(mod: Mod, name: string): string { const foundCounter = globalNodeCounters.get(name) diff --git a/src/lang/node/formatNode.ts b/src/lang/node/formatNode.ts index d7bc2fe5..ecca4cec 100644 --- a/src/lang/node/formatNode.ts +++ b/src/lang/node/formatNode.ts @@ -1,5 +1,5 @@ -import { stringToSubscript } from "../../utils/stringToSubscript" -import { Node } from "../node" +import { stringToSubscript } from "../../utils/stringToSubscript.js" +import { type Node } from "../node/index.js" export function formatNode(node: Node): string { const subscript = stringToSubscript(node.id.toString()) diff --git a/src/lang/node/index.ts b/src/lang/node/index.ts index 911798e5..8d940ba3 100644 --- a/src/lang/node/index.ts +++ b/src/lang/node/index.ts @@ -1,5 +1,5 @@ -export * from "./Node" -export * from "./formatNode" -export * from "./nodeEqual" -export * from "./nodeKey" -export * from "./nodeKeyWithoutId" +export * from "./Node.js" +export * from "./formatNode.js" +export * from "./nodeEqual.js" +export * from "./nodeKey.js" +export * from "./nodeKeyWithoutId.js" diff --git a/src/lang/node/nodeEqual.ts b/src/lang/node/nodeEqual.ts index 80db4354..2d7161c7 100644 --- a/src/lang/node/nodeEqual.ts +++ b/src/lang/node/nodeEqual.ts @@ -1,4 +1,4 @@ -import { Node } from "./Node" +import { type Node } from "./Node.js" export function nodeEqual(x: Node, y: Node): boolean { return x.name === y.name && x.id === y.id diff --git a/src/lang/node/nodeKey.ts b/src/lang/node/nodeKey.ts index b391069a..82f9e80d 100644 --- a/src/lang/node/nodeKey.ts +++ b/src/lang/node/nodeKey.ts @@ -1,4 +1,4 @@ -import { Node } from "./Node" +import { type Node } from "./Node.js" export function nodeKey(node: Node): string { return `${node.url.href}/${node.name}#${node.id}` diff --git a/src/lang/node/nodeKeyWithoutId.ts b/src/lang/node/nodeKeyWithoutId.ts index ce416c50..ea04c8a8 100644 --- a/src/lang/node/nodeKeyWithoutId.ts +++ b/src/lang/node/nodeKeyWithoutId.ts @@ -1,4 +1,4 @@ -import { NodeWithoutId } from "./Node" +import { type NodeWithoutId } from "./Node.js" export function nodeKeyWithoutId(node: NodeWithoutId): string { return `${node.url.href}/${node.name}` diff --git a/src/lang/port/Port.ts b/src/lang/port/Port.ts index 85da25c0..b5350ec1 100644 --- a/src/lang/port/Port.ts +++ b/src/lang/port/Port.ts @@ -1,6 +1,6 @@ -import { Node } from "../node" -import { Sign } from "../sign" -import { Value } from "../value" +import { type Node } from "../node/index.js" +import { type Sign } from "../sign/index.js" +import { type Value } from "../value/index.js" export type Port = { "@type": "Value" diff --git a/src/lang/port/PortExp.ts b/src/lang/port/PortExp.ts index 3f43de30..4ed8aa19 100644 --- a/src/lang/port/PortExp.ts +++ b/src/lang/port/PortExp.ts @@ -1,4 +1,4 @@ -import { Value } from "../value" +import { type Value } from "../value/index.js" export type PortExp = { "@type": "PortExp" diff --git a/src/lang/port/createInputPort.ts b/src/lang/port/createInputPort.ts index 5c0371e7..c42fe978 100644 --- a/src/lang/port/createInputPort.ts +++ b/src/lang/port/createInputPort.ts @@ -1,6 +1,6 @@ -import { Node } from "../node" -import { PortExp } from "../port/PortExp" -import { Port } from "./Port" +import { type Node } from "../node/index.js" +import { type PortExp } from "../port/PortExp.js" +import { type Port } from "./Port.js" export function createInputPort(node: Node, portExp: PortExp): Port { return { diff --git a/src/lang/port/createOutputPort.ts b/src/lang/port/createOutputPort.ts index c2a20061..6cf27b02 100644 --- a/src/lang/port/createOutputPort.ts +++ b/src/lang/port/createOutputPort.ts @@ -1,6 +1,6 @@ -import { Node } from "../node" -import { PortExp } from "../port/PortExp" -import { Port } from "./Port" +import { type Node } from "../node/index.js" +import { type PortExp } from "../port/PortExp.js" +import { type Port } from "./Port.js" export function createOutputPort(node: Node, portExp: PortExp): Port { return { diff --git a/src/lang/port/index.ts b/src/lang/port/index.ts index 9cab4353..98eed775 100644 --- a/src/lang/port/index.ts +++ b/src/lang/port/index.ts @@ -1,2 +1,2 @@ -export * from "./Port" -export * from "./portEqual" +export * from "./Port.js" +export * from "./portEqual.js" diff --git a/src/lang/port/portEqual.ts b/src/lang/port/portEqual.ts index cd832231..4bbe794f 100644 --- a/src/lang/port/portEqual.ts +++ b/src/lang/port/portEqual.ts @@ -1,5 +1,5 @@ -import { nodeEqual } from "../node/nodeEqual" -import { Port } from "./Port" +import { nodeEqual } from "../node/nodeEqual.js" +import { type Port } from "./Port.js" export function portEqual(x: Port, y: Port): boolean { return nodeEqual(x.node, y.node) && x.name === y.name diff --git a/src/lang/present/index.ts b/src/lang/present/index.ts index f8796614..c54462d4 100644 --- a/src/lang/present/index.ts +++ b/src/lang/present/index.ts @@ -1,3 +1,3 @@ -export * from "./presentNodeAsNet" -export * from "./presentRuleAsNets" -export * from "./presentWordAsEnv" +export * from "./presentNodeAsNet.js" +export * from "./presentRuleAsNets.js" +export * from "./presentWordAsEnv.js" diff --git a/src/lang/present/presentNodeAsNet.test.ts b/src/lang/present/presentNodeAsNet.test.ts index b28d0b44..4ba374a0 100644 --- a/src/lang/present/presentNodeAsNet.test.ts +++ b/src/lang/present/presentNodeAsNet.test.ts @@ -1,8 +1,8 @@ import { expect, test } from "vitest" -import { Fetcher } from "../../fetcher" -import { Loader } from "../../loader" -import { formatNet } from "../net/formatNet" -import { presentNodeAsNet } from "./presentNodeAsNet" +import { Fetcher } from "../../fetcher/index.js" +import { Loader } from "../../loader/index.js" +import { formatNet } from "../net/formatNet.js" +import { presentNodeAsNet } from "./presentNodeAsNet.js" test("presentNodeAsNet", async () => { const text = ` diff --git a/src/lang/present/presentNodeAsNet.ts b/src/lang/present/presentNodeAsNet.ts index f2cbb632..f9cb034f 100644 --- a/src/lang/present/presentNodeAsNet.ts +++ b/src/lang/present/presentNodeAsNet.ts @@ -1,7 +1,7 @@ -import { capNodeAllPorts } from "../cap" -import { Mod, findDefinitionOrFail } from "../mod" -import { Net, createNet } from "../net" -import { createNodeFromDefinition } from "../node/createNodeFromDefinition" +import { capNodeAllPorts } from "../cap/index.js" +import { findDefinitionOrFail, type Mod } from "../mod/index.js" +import { createNet, type Net } from "../net/index.js" +import { createNodeFromDefinition } from "../node/createNodeFromDefinition.js" export function presentNodeAsNet(mod: Mod, nodeName: string): Net { const net = createNet() diff --git a/src/lang/present/presentRuleAsNets.test.ts b/src/lang/present/presentRuleAsNets.test.ts index 358d0349..0c7fa313 100644 --- a/src/lang/present/presentRuleAsNets.test.ts +++ b/src/lang/present/presentRuleAsNets.test.ts @@ -1,8 +1,8 @@ import { expect, test } from "vitest" -import { Fetcher } from "../../fetcher" -import { Loader } from "../../loader" -import { formatNet } from "../net/formatNet" -import { presentRuleAsNets } from "./presentRuleAsNets" +import { Fetcher } from "../../fetcher/index.js" +import { Loader } from "../../loader/index.js" +import { formatNet } from "../net/formatNet.js" +import { presentRuleAsNets } from "./presentRuleAsNets.js" test("presentRuleAsNets", async () => { const text = ` diff --git a/src/lang/present/presentRuleAsNets.ts b/src/lang/present/presentRuleAsNets.ts index 39b190e7..03e654e1 100644 --- a/src/lang/present/presentRuleAsNets.ts +++ b/src/lang/present/presentRuleAsNets.ts @@ -1,14 +1,14 @@ -import { capNodeNonPrinciplePorts } from "../cap" -import { compose } from "../compose/compose" -import { connect } from "../connect/connect" -import { createEnv } from "../env/createEnv" -import { Mod, findDefinitionOrFail } from "../mod" -import { findRuleByName } from "../mod/findRuleByName" -import { Net, copyConnectedComponent, createNet } from "../net" -import { deleteNodeEntry } from "../net/deleteNodeEntry" -import { findPrincipalPort } from "../net/findPrincipalPort" -import { Node } from "../node" -import { createNodeFromDefinition } from "../node/createNodeFromDefinition" +import { capNodeNonPrinciplePorts } from "../cap/index.js" +import { compose } from "../compose/compose.js" +import { connect } from "../connect/connect.js" +import { createEnv } from "../env/createEnv.js" +import { findRuleByName } from "../mod/findRuleByName.js" +import { findDefinitionOrFail, type Mod } from "../mod/index.js" +import { deleteNodeEntry } from "../net/deleteNodeEntry.js" +import { findPrincipalPort } from "../net/findPrincipalPort.js" +import { copyConnectedComponent, createNet, type Net } from "../net/index.js" +import { createNodeFromDefinition } from "../node/createNodeFromDefinition.js" +import { type Node } from "../node/index.js" export function presentRuleAsNets(mod: Mod, ruleName: string): [Net, Net] { const env = createEnv(mod) diff --git a/src/lang/present/presentWordAsEnv.test.ts b/src/lang/present/presentWordAsEnv.test.ts index a7b08e95..aeeb5b00 100644 --- a/src/lang/present/presentWordAsEnv.test.ts +++ b/src/lang/present/presentWordAsEnv.test.ts @@ -1,8 +1,8 @@ import { expect, test } from "vitest" -import { Fetcher } from "../../fetcher" -import { Loader } from "../../loader" -import { formatEnv } from "../env/formatEnv" -import { presentWordAsEnv } from "./presentWordAsEnv" +import { Fetcher } from "../../fetcher/index.js" +import { Loader } from "../../loader/index.js" +import { formatEnv } from "../env/formatEnv.js" +import { presentWordAsEnv } from "./presentWordAsEnv.js" test("presentWordAsEnv", async () => { const text = ` diff --git a/src/lang/present/presentWordAsEnv.ts b/src/lang/present/presentWordAsEnv.ts index 08a51862..33383a4a 100644 --- a/src/lang/present/presentWordAsEnv.ts +++ b/src/lang/present/presentWordAsEnv.ts @@ -1,10 +1,10 @@ -import { capType } from "../cap" -import { collectWords } from "../compose/collectWords" -import { compose } from "../compose/compose" -import { Env } from "../env" -import { createEnv } from "../env/createEnv" -import { Mod, findDefinitionOrFail } from "../mod" -import { formatWord } from "../word" +import { capType } from "../cap/index.js" +import { collectWords } from "../compose/collectWords.js" +import { compose } from "../compose/compose.js" +import { createEnv } from "../env/createEnv.js" +import { type Env } from "../env/index.js" +import { findDefinitionOrFail, type Mod } from "../mod/index.js" +import { formatWord } from "../word/index.js" export function presentWordAsEnv(mod: Mod, name: string): Env { const definition = findDefinitionOrFail(mod, name) diff --git a/src/lang/rule/Rule.ts b/src/lang/rule/Rule.ts index 19d5d73b..4189e63c 100644 --- a/src/lang/rule/Rule.ts +++ b/src/lang/rule/Rule.ts @@ -1,5 +1,5 @@ -import { Mod } from "../mod" -import { Word } from "../word" +import { type Mod } from "../mod/index.js" +import { type Word } from "../word/index.js" export type Rule = { mod: Mod diff --git a/src/lang/rule/index.ts b/src/lang/rule/index.ts index 8aeeb72c..6974d98b 100644 --- a/src/lang/rule/index.ts +++ b/src/lang/rule/index.ts @@ -1 +1 @@ -export * from "./Rule" +export * from "./Rule.js" diff --git a/src/lang/run/closeAllFreePorts.ts b/src/lang/run/closeAllFreePorts.ts index 795801f8..cc88d752 100644 --- a/src/lang/run/closeAllFreePorts.ts +++ b/src/lang/run/closeAllFreePorts.ts @@ -1,10 +1,10 @@ -import { capInputPort } from "../cap/capInputPort" -import { capOutputPort } from "../cap/capOutputPort" -import { Mod } from "../mod" -import { Net } from "../net" -import { createNodeFromNodeEntry } from "../net/createNodeFromNodeEntry" -import { createPortFromPortEntry } from "../net/createPortFromPortEntry" -import { Port } from "../port" +import { capInputPort } from "../cap/capInputPort.js" +import { capOutputPort } from "../cap/capOutputPort.js" +import { type Mod } from "../mod/index.js" +import { createNodeFromNodeEntry } from "../net/createNodeFromNodeEntry.js" +import { createPortFromPortEntry } from "../net/createPortFromPortEntry.js" +import { type Net } from "../net/index.js" +import { type Port } from "../port/index.js" /* diff --git a/src/lang/run/closePort.ts b/src/lang/run/closePort.ts index af8ce224..baaafacf 100644 --- a/src/lang/run/closePort.ts +++ b/src/lang/run/closePort.ts @@ -1,8 +1,8 @@ -import { capInputPort } from "../cap/capInputPort" -import { capOutputPort } from "../cap/capOutputPort" -import { Mod } from "../mod" -import { Net } from "../net" -import { Port } from "../port" +import { capInputPort } from "../cap/capInputPort.js" +import { capOutputPort } from "../cap/capOutputPort.js" +import { type Mod } from "../mod/index.js" +import { type Net } from "../net/index.js" +import { type Port } from "../port/index.js" export function closePort(mod: Mod, component: Net, port: Port): Port { return port.sign === 1 diff --git a/src/lang/run/collectConnectedPort.ts b/src/lang/run/collectConnectedPort.ts index b445f00b..236cbcf6 100644 --- a/src/lang/run/collectConnectedPort.ts +++ b/src/lang/run/collectConnectedPort.ts @@ -1,9 +1,9 @@ -import { Net } from "../net" -import { deleteNodeEntry } from "../net/deleteNodeEntry" -import { disconnectPort } from "../net/disconnectPort" -import { findPortEntry } from "../net/findPortEntry" -import { Port } from "../port" -import { formatValue } from "../value/formatValue" +import { deleteNodeEntry } from "../net/deleteNodeEntry.js" +import { disconnectPort } from "../net/disconnectPort.js" +import { findPortEntry } from "../net/findPortEntry.js" +import { type Net } from "../net/index.js" +import { type Port } from "../port/index.js" +import { formatValue } from "../value/formatValue.js" export function collectConnectedPort(component: Net, capPort: Port): Port { const capPortEntry = findPortEntry(component, capPort) diff --git a/src/lang/run/index.ts b/src/lang/run/index.ts index 8f3a153b..7d534def 100644 --- a/src/lang/run/index.ts +++ b/src/lang/run/index.ts @@ -1,4 +1,4 @@ -export * from "./closeAllFreePorts" -export * from "./releaseCapPorts" -export * from "./runNet" -export * from "./runPort" +export * from "./closeAllFreePorts.js" +export * from "./releaseCapPorts.js" +export * from "./runNet.js" +export * from "./runPort.js" diff --git a/src/lang/run/releaseCapPorts.ts b/src/lang/run/releaseCapPorts.ts index 95f3d50c..2e0982e4 100644 --- a/src/lang/run/releaseCapPorts.ts +++ b/src/lang/run/releaseCapPorts.ts @@ -1,7 +1,7 @@ -import { Net } from "../net" -import { deleteNodeEntry } from "../net/deleteNodeEntry" -import { disconnectPort } from "../net/disconnectPort" -import { Port } from "../port" +import { deleteNodeEntry } from "../net/deleteNodeEntry.js" +import { disconnectPort } from "../net/disconnectPort.js" +import { type Net } from "../net/index.js" +import { type Port } from "../port/index.js" export function releaseCapPorts(component: Net, capPorts: Array): void { for (const capPort of capPorts) { diff --git a/src/lang/run/runNet.ts b/src/lang/run/runNet.ts index 4ffe9edf..9c75cb11 100644 --- a/src/lang/run/runNet.ts +++ b/src/lang/run/runNet.ts @@ -1,7 +1,7 @@ -import { createEnv } from "../env/createEnv" -import { interact } from "../interact" -import { Mod } from "../mod" -import { Net } from "../net" +import { createEnv } from "../env/createEnv.js" +import { interact } from "../interact/index.js" +import { type Mod } from "../mod/index.js" +import { type Net } from "../net/index.js" export function runNet(mod: Mod, net: Net): void { const env = createEnv(mod, { net }) diff --git a/src/lang/run/runPort.ts b/src/lang/run/runPort.ts index e12e3894..90ab777d 100644 --- a/src/lang/run/runPort.ts +++ b/src/lang/run/runPort.ts @@ -1,13 +1,13 @@ -import { Mod } from "../mod" -import { Net } from "../net" -import { createNet } from "../net/createNet" -import { moveConnectedComponent } from "../net/moveConnectedComponent" -import { Port } from "../port" -import { closeAllFreePorts } from "./closeAllFreePorts" -import { closePort } from "./closePort" -import { collectConnectedPort } from "./collectConnectedPort" -import { releaseCapPorts } from "./releaseCapPorts" -import { runNet } from "./runNet" +import { type Mod } from "../mod/index.js" +import { createNet } from "../net/createNet.js" +import { type Net } from "../net/index.js" +import { moveConnectedComponent } from "../net/moveConnectedComponent.js" +import { type Port } from "../port/index.js" +import { closeAllFreePorts } from "./closeAllFreePorts.js" +import { closePort } from "./closePort.js" +import { collectConnectedPort } from "./collectConnectedPort.js" +import { releaseCapPorts } from "./releaseCapPorts.js" +import { runNet } from "./runNet.js" export function runPort(mod: Mod, net: Net, port: Port): Port { const component = createNet() diff --git a/src/lang/sign/index.ts b/src/lang/sign/index.ts index 222ee9a9..51c1b14d 100644 --- a/src/lang/sign/index.ts +++ b/src/lang/sign/index.ts @@ -1 +1 @@ -export * from "./Sign" +export * from "./Sign.js" diff --git a/src/lang/span/index.ts b/src/lang/span/index.ts index 3c6037a3..a02defe2 100644 --- a/src/lang/span/index.ts +++ b/src/lang/span/index.ts @@ -1 +1 @@ -export { Span } from "@cicada-lang/partech/lib/span" +export { type Span } from "@cicada-lang/partech/lib/span/index.js" diff --git a/src/lang/stmt/Stmt.ts b/src/lang/stmt/Stmt.ts index 31bc1fcf..6ebf4911 100644 --- a/src/lang/stmt/Stmt.ts +++ b/src/lang/stmt/Stmt.ts @@ -1,5 +1,5 @@ -import { Mod } from "../mod" -import { Span } from "../span" +import { type Mod } from "../mod/index.js" +import { type Span } from "../span/index.js" export interface Stmt { span: Span diff --git a/src/lang/stmt/index.ts b/src/lang/stmt/index.ts index b071b5d6..b54cfa1f 100644 --- a/src/lang/stmt/index.ts +++ b/src/lang/stmt/index.ts @@ -1 +1 @@ -export * from "./Stmt" +export * from "./Stmt.js" diff --git a/src/lang/stmts/Check.ts b/src/lang/stmts/Check.ts index 87f80b71..1db91503 100644 --- a/src/lang/stmts/Check.ts +++ b/src/lang/stmts/Check.ts @@ -1,9 +1,9 @@ -import { checkWords } from "../check/checkWords" -import { appendReport } from "../errors/appendReport" -import { Mod } from "../mod" -import { Span } from "../span" -import { Stmt } from "../stmt" -import { Word } from "../word" +import { checkWords } from "../check/checkWords.js" +import { appendReport } from "../errors/appendReport.js" +import { type Mod } from "../mod/index.js" +import { type Span } from "../span/index.js" +import { type Stmt } from "../stmt/index.js" +import { type Word } from "../word/index.js" // Just like unnamed `claim` + `define`. diff --git a/src/lang/stmts/Claim.ts b/src/lang/stmts/Claim.ts index 759fd227..4d3f5ed4 100644 --- a/src/lang/stmts/Claim.ts +++ b/src/lang/stmts/Claim.ts @@ -1,12 +1,12 @@ -import { definitionMaybeSpan } from "../definition/definitionMaybeSpan" -import { appendReport } from "../errors/appendReport" -import { createReport } from "../errors/createReport" -import { Mod } from "../mod" -import { define } from "../mod/define" -import { findDefinition } from "../mod/findDefinition" -import { Span } from "../span" -import { Stmt } from "../stmt" -import { Word } from "../word" +import { definitionMaybeSpan } from "../definition/definitionMaybeSpan.js" +import { appendReport } from "../errors/appendReport.js" +import { createReport } from "../errors/createReport.js" +import { define } from "../mod/define.js" +import { findDefinition } from "../mod/findDefinition.js" +import { type Mod } from "../mod/index.js" +import { type Span } from "../span/index.js" +import { type Stmt } from "../stmt/index.js" +import { type Word } from "../word/index.js" export class Claim implements Stmt { constructor( diff --git a/src/lang/stmts/Compose.ts b/src/lang/stmts/Compose.ts index 8847d4e6..0e49b21c 100644 --- a/src/lang/stmts/Compose.ts +++ b/src/lang/stmts/Compose.ts @@ -1,10 +1,10 @@ import { compose } from "../compose/compose.js" import { appendReport } from "../errors/appendReport.js" -import { Mod } from "../mod/index.js" -import { Span } from "../span/index.js" -import { Stmt } from "../stmt/index.js" +import { type Mod } from "../mod/index.js" +import { type Span } from "../span/index.js" +import { type Stmt } from "../stmt/index.js" import { formatWord } from "../word/formatWord.js" -import { Word } from "../word/index.js" +import { type Word } from "../word/index.js" export class Compose implements Stmt { constructor( diff --git a/src/lang/stmts/Define.ts b/src/lang/stmts/Define.ts index ea88062c..ab26c666 100644 --- a/src/lang/stmts/Define.ts +++ b/src/lang/stmts/Define.ts @@ -1,12 +1,12 @@ -import { checkWords } from "../check/checkWords" -import { definitionMaybeSpan } from "../definition/definitionMaybeSpan" -import { appendReport } from "../errors/appendReport" -import { createReport } from "../errors/createReport" -import { Mod } from "../mod" -import { findDefinitionOrFail } from "../mod/findDefinitionOrFail" -import { Span } from "../span" -import { Stmt } from "../stmt" -import { Word } from "../word" +import { checkWords } from "../check/checkWords.js" +import { definitionMaybeSpan } from "../definition/definitionMaybeSpan.js" +import { appendReport } from "../errors/appendReport.js" +import { createReport } from "../errors/createReport.js" +import { findDefinitionOrFail } from "../mod/findDefinitionOrFail.js" +import { type Mod } from "../mod/index.js" +import { type Span } from "../span/index.js" +import { type Stmt } from "../stmt/index.js" +import { type Word } from "../word/index.js" export class Define implements Stmt { constructor( diff --git a/src/lang/stmts/DefineNode.ts b/src/lang/stmts/DefineNode.ts index 20619366..191cf49b 100644 --- a/src/lang/stmts/DefineNode.ts +++ b/src/lang/stmts/DefineNode.ts @@ -1,10 +1,10 @@ -import { checkNode } from "../check/checkNode" -import { appendReport } from "../errors/appendReport" -import { Mod } from "../mod" -import { define } from "../mod/define" -import { Span } from "../span" -import { Stmt } from "../stmt" -import { Word } from "../word" +import { checkNode } from "../check/checkNode.js" +import { appendReport } from "../errors/appendReport.js" +import { define } from "../mod/define.js" +import { type Mod } from "../mod/index.js" +import { type Span } from "../span/index.js" +import { type Stmt } from "../stmt/index.js" +import { type Word } from "../word/index.js" export class DefineNode implements Stmt { constructor( diff --git a/src/lang/stmts/DefineRule.ts b/src/lang/stmts/DefineRule.ts index 274ecc64..90d52ed3 100644 --- a/src/lang/stmts/DefineRule.ts +++ b/src/lang/stmts/DefineRule.ts @@ -1,12 +1,12 @@ -import { checkRule } from "../check/checkRule" -import { checkRuleIsAboutOwnNode } from "../check/checkRuleIsAboutOwnNode" -import { checkRuleNodeOrder } from "../check/checkRuleNodeOrder" -import { appendReport } from "../errors/appendReport" -import { Mod } from "../mod" -import { defineRule } from "../mod/defineRule" -import { Span } from "../span" -import { Stmt } from "../stmt" -import { Word } from "../word" +import { checkRule } from "../check/checkRule.js" +import { checkRuleIsAboutOwnNode } from "../check/checkRuleIsAboutOwnNode.js" +import { checkRuleNodeOrder } from "../check/checkRuleNodeOrder.js" +import { appendReport } from "../errors/appendReport.js" +import { defineRule } from "../mod/defineRule.js" +import { type Mod } from "../mod/index.js" +import { type Span } from "../span/index.js" +import { type Stmt } from "../stmt/index.js" +import { type Word } from "../word/index.js" export class DefineRule implements Stmt { constructor( diff --git a/src/lang/stmts/DefineType.ts b/src/lang/stmts/DefineType.ts index 90bf68bc..3c2b684e 100644 --- a/src/lang/stmts/DefineType.ts +++ b/src/lang/stmts/DefineType.ts @@ -1,10 +1,10 @@ -import { checkType } from "../check/checkType" -import { appendReport } from "../errors/appendReport" -import { Mod } from "../mod" -import { define } from "../mod/define" -import { Span } from "../span" -import { Stmt } from "../stmt" -import { Word } from "../word" +import { checkType } from "../check/checkType.js" +import { appendReport } from "../errors/appendReport.js" +import { define } from "../mod/define.js" +import { type Mod } from "../mod/index.js" +import { type Span } from "../span/index.js" +import { type Stmt } from "../stmt/index.js" +import { type Word } from "../word/index.js" export class DefineType implements Stmt { constructor( diff --git a/src/lang/stmts/Import.ts b/src/lang/stmts/Import.ts index 66ffed0f..f4ebebde 100644 --- a/src/lang/stmts/Import.ts +++ b/src/lang/stmts/Import.ts @@ -1,10 +1,10 @@ -import { appendReport } from "../errors/appendReport" -import { ImportBinding } from "../import/ImportBinding" -import { formatImportBinding } from "../import/formatImportBinding" -import { importMany } from "../import/importMany" -import { Mod } from "../mod" -import { Span } from "../span" -import { Stmt } from "../stmt" +import { appendReport } from "../errors/appendReport.js" +import { type ImportBinding } from "../import/ImportBinding.js" +import { formatImportBinding } from "../import/formatImportBinding.js" +import { importMany } from "../import/importMany.js" +import { type Mod } from "../mod/index.js" +import { type Span } from "../span/index.js" +import { type Stmt } from "../stmt/index.js" export class Import implements Stmt { constructor( diff --git a/src/lang/stmts/Require.ts b/src/lang/stmts/Require.ts index 04753260..de89405a 100644 --- a/src/lang/stmts/Require.ts +++ b/src/lang/stmts/Require.ts @@ -1,8 +1,8 @@ -import { appendReport } from "../errors/appendReport" -import { importAll } from "../import/importAll" -import { Mod } from "../mod" -import { Span } from "../span" -import { Stmt } from "../stmt" +import { appendReport } from "../errors/appendReport.js" +import { importAll } from "../import/importAll.js" +import { type Mod } from "../mod/index.js" +import { type Span } from "../span/index.js" +import { type Stmt } from "../stmt/index.js" export class Require implements Stmt { constructor( diff --git a/src/lang/stmts/index.ts b/src/lang/stmts/index.ts index ef15f0c4..de1eac57 100644 --- a/src/lang/stmts/index.ts +++ b/src/lang/stmts/index.ts @@ -1,9 +1,9 @@ -export * from "./Check" -export * from "./Claim" -export * from "./Compose" -export * from "./Define" -export * from "./DefineNode" -export * from "./DefineRule" -export * from "./DefineType" -export * from "./Import" -export * from "./Require" +export * from "./Check.js" +export * from "./Claim.js" +export * from "./Compose.js" +export * from "./Define.js" +export * from "./DefineNode.js" +export * from "./DefineRule.js" +export * from "./DefineType.js" +export * from "./Import.js" +export * from "./Require.js" diff --git a/src/lang/syntax/grammars/index.ts b/src/lang/syntax/grammars/index.ts index 98439cf0..12e9c0c0 100644 --- a/src/lang/syntax/grammars/index.ts +++ b/src/lang/syntax/grammars/index.ts @@ -5,8 +5,8 @@ export const one_or_more = pt.grammars.one_or_more export const optional = pt.grammars.optional export const dashline = pt.grammars.dashline -export * from "./import_binding" -export * from "./label" -export * from "./name" -export * from "./stmt" -export * from "./word" +export * from "./import_binding.js" +export * from "./label.js" +export * from "./name.js" +export * from "./stmt.js" +export * from "./word.js" diff --git a/src/lang/syntax/index.ts b/src/lang/syntax/index.ts index 9ec56324..750aee63 100644 --- a/src/lang/syntax/index.ts +++ b/src/lang/syntax/index.ts @@ -1,6 +1,6 @@ import * as pt from "@cicada-lang/partech" -import * as grammars from "./grammars" -import * as matchers from "./matchers" +import * as grammars from "./grammars/index.js" +import * as matchers from "./matchers/index.js" /** diff --git a/src/lang/syntax/matchers/import_binding_matcher.ts b/src/lang/syntax/matchers/import_binding_matcher.ts index 371e0d84..d440579b 100644 --- a/src/lang/syntax/matchers/import_binding_matcher.ts +++ b/src/lang/syntax/matchers/import_binding_matcher.ts @@ -1,6 +1,6 @@ import * as pt from "@cicada-lang/partech" -import { ImportBinding } from "../../import/ImportBinding" -import * as matchers from "../matchers" +import { type ImportBinding } from "../../import/ImportBinding.js" +import * as matchers from "../matchers/index.js" export function import_binding_matcher(tree: pt.Tree): ImportBinding { return pt.matcher({ diff --git a/src/lang/syntax/matchers/index.ts b/src/lang/syntax/matchers/index.ts index a96bafcc..fb91127f 100644 --- a/src/lang/syntax/matchers/index.ts +++ b/src/lang/syntax/matchers/index.ts @@ -1,5 +1,5 @@ -export * from "./import_binding_matcher" -export * from "./label_matcher" -export * from "./name_matcher" -export * from "./stmt_matcher" -export * from "./word_matcher" +export * from "./import_binding_matcher.js" +export * from "./label_matcher.js" +export * from "./name_matcher.js" +export * from "./stmt_matcher.js" +export * from "./word_matcher.js" diff --git a/src/lang/syntax/matchers/stmt_matcher.ts b/src/lang/syntax/matchers/stmt_matcher.ts index 203abd08..d90bee1e 100644 --- a/src/lang/syntax/matchers/stmt_matcher.ts +++ b/src/lang/syntax/matchers/stmt_matcher.ts @@ -1,7 +1,7 @@ import * as pt from "@cicada-lang/partech" -import type { Stmt } from "../../stmt" -import * as Stmts from "../../stmts" -import * as matchers from "../matchers" +import type { Stmt } from "../../stmt/index.js" +import * as Stmts from "../../stmts/index.js" +import * as matchers from "../matchers/index.js" export function stmt_matcher(tree: pt.Tree): Stmt { return pt.matcher({ diff --git a/src/lang/syntax/matchers/word_matcher.ts b/src/lang/syntax/matchers/word_matcher.ts index 71c44d67..caab95f0 100644 --- a/src/lang/syntax/matchers/word_matcher.ts +++ b/src/lang/syntax/matchers/word_matcher.ts @@ -1,5 +1,5 @@ import * as pt from "@cicada-lang/partech" -import { Word } from "../../word" +import { type Word } from "../../word/index.js" export function word_matcher(tree: pt.Tree): Word { return pt.matcher({ diff --git a/src/lang/unify/deepWalkType.ts b/src/lang/unify/deepWalkType.ts index 05cf689a..602575e8 100644 --- a/src/lang/unify/deepWalkType.ts +++ b/src/lang/unify/deepWalkType.ts @@ -1,4 +1,4 @@ -import { Value } from "../value" +import { type Value } from "../value/index.js" export function deepWalkType( substitution: Map, diff --git a/src/lang/unify/occurInType.ts b/src/lang/unify/occurInType.ts index 350a1a3a..752c4ccc 100644 --- a/src/lang/unify/occurInType.ts +++ b/src/lang/unify/occurInType.ts @@ -1,5 +1,5 @@ -import { Value } from "../value" -import { walkType } from "./walkType" +import { type Value } from "../value/index.js" +import { walkType } from "./walkType.js" export function occurInType( substitution: Map, diff --git a/src/lang/unify/unifyTypes.ts b/src/lang/unify/unifyTypes.ts index 7b63d980..b51b63ef 100644 --- a/src/lang/unify/unifyTypes.ts +++ b/src/lang/unify/unifyTypes.ts @@ -1,10 +1,10 @@ -import { appendReport } from "../errors/appendReport" -import { createReport } from "../errors/createReport" -import { Value } from "../value" -import { formatValue } from "../value/formatValue" -import { deepWalkType } from "./deepWalkType" -import { occurInType } from "./occurInType" -import { walkType } from "./walkType" +import { appendReport } from "../errors/appendReport.js" +import { createReport } from "../errors/createReport.js" +import { formatValue } from "../value/formatValue.js" +import { type Value } from "../value/index.js" +import { deepWalkType } from "./deepWalkType.js" +import { occurInType } from "./occurInType.js" +import { walkType } from "./walkType.js" export function unifyTypes( substitution: Map, diff --git a/src/lang/unify/walkType.ts b/src/lang/unify/walkType.ts index e523a30a..34a6078e 100644 --- a/src/lang/unify/walkType.ts +++ b/src/lang/unify/walkType.ts @@ -1,4 +1,4 @@ -import { Value } from "../value" +import { type Value } from "../value/index.js" export function walkType(substitution: Map, t: Value): Value { while (t["@kind"] === "Symbol") { diff --git a/src/lang/value/Value.ts b/src/lang/value/Value.ts index 1801333b..83bb43a4 100644 --- a/src/lang/value/Value.ts +++ b/src/lang/value/Value.ts @@ -1,5 +1,5 @@ -import { Node } from "../node" -import { Port } from "../port" +import { type Node } from "../node/index.js" +import { type Port } from "../port/index.js" export type Value = Port | Node | Type | Symbol | TypeTerm | Labeled diff --git a/src/lang/value/formatValue.ts b/src/lang/value/formatValue.ts index 9f501595..75342d04 100644 --- a/src/lang/value/formatValue.ts +++ b/src/lang/value/formatValue.ts @@ -1,5 +1,5 @@ -import { formatNode } from "../node/formatNode" -import { Value } from "./Value" +import { formatNode } from "../node/formatNode.js" +import { type Value } from "./Value.js" export function formatValue(value: Value): string { switch (value["@kind"]) { diff --git a/src/lang/value/index.ts b/src/lang/value/index.ts index f9f290dd..a7cb147f 100644 --- a/src/lang/value/index.ts +++ b/src/lang/value/index.ts @@ -1,2 +1,2 @@ -export * from "./Value" -export * from "./formatValue" +export * from "./Value.js" +export * from "./formatValue.js" diff --git a/src/lang/word/Word.ts b/src/lang/word/Word.ts index 060c187d..5ee3bf81 100644 --- a/src/lang/word/Word.ts +++ b/src/lang/word/Word.ts @@ -1,4 +1,4 @@ -import { Span } from "../span" +import { type Span } from "../span/index.js" export type Word = | Call diff --git a/src/lang/word/formatWord.ts b/src/lang/word/formatWord.ts index d5985753..a87bda94 100644 --- a/src/lang/word/formatWord.ts +++ b/src/lang/word/formatWord.ts @@ -1,4 +1,4 @@ -import { Word } from "./Word" +import { type Word } from "./Word.js" export function formatWord(word: Word): string { switch (word["@kind"]) { diff --git a/src/lang/word/index.ts b/src/lang/word/index.ts index 71df04f4..408907c5 100644 --- a/src/lang/word/index.ts +++ b/src/lang/word/index.ts @@ -1,2 +1,2 @@ -export * from "./Word" -export * from "./formatWord" +export * from "./Word.js" +export * from "./formatWord.js" diff --git a/src/loader/Loader.ts b/src/loader/Loader.ts index 2b193fe3..1abdc123 100644 --- a/src/loader/Loader.ts +++ b/src/loader/Loader.ts @@ -1,7 +1,7 @@ -import { Fetcher } from "../fetcher" -import { Mod } from "../lang/mod" -import { createMod } from "../lang/mod/createMod" -import { parseStmts } from "../lang/syntax" +import { Fetcher } from "../fetcher/index.js" +import { createMod } from "../lang/mod/createMod.js" +import { type Mod } from "../lang/mod/index.js" +import { parseStmts } from "../lang/syntax/index.js" export class Loader { loaded: Map = new Map() diff --git a/src/loader/index.ts b/src/loader/index.ts index 80aacd08..753abcad 100644 --- a/src/loader/index.ts +++ b/src/loader/index.ts @@ -1 +1 @@ -export * from "./Loader" +export * from "./Loader.js" diff --git a/src/version.ts b/src/version.ts new file mode 100644 index 00000000..edc2476d --- /dev/null +++ b/src/version.ts @@ -0,0 +1 @@ +export const version = "0.2.0" diff --git a/tsconfig.json b/tsconfig.json index 9aeb9bbf..4b7619c5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,14 +2,14 @@ "include": ["src"], "compilerOptions": { "lib": ["esnext", "dom"], + "module": "node16", "target": "es6", - "module": "commonjs", - "moduleResolution": "node", - "esModuleInterop": true, - "resolveJsonModule": true, - "declaration": true, "strict": true, - "outDir": "lib", - "baseUrl": "." + "verbatimModuleSyntax": true, + "declaration": true, + "sourceMap": true, + "declarationMap": true, + "resolveJsonModule": true, + "outDir": "lib" } }