From 29ab81bfc108671b8edc76485ee640ea9067de33 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Tue, 20 Jan 2026 21:16:52 -0800 Subject: [PATCH] fix imports --- example/bun.lock | 2 +- package.json | 7 +++---- src/client.ts | 3 --- src/client/index.ts | 3 +++ src/client/setup.ts | 2 +- src/client/websocket.ts | 4 ++-- src/server/action.ts | 4 ++-- src/server/actionCodegen.ts | 4 ++-- src/server/index.tsx | 12 ++++++------ src/server/websocket.ts | 2 +- tsconfig.json | 7 +------ 11 files changed, 22 insertions(+), 28 deletions(-) delete mode 100644 src/client.ts create mode 100644 src/client/index.ts diff --git a/example/bun.lock b/example/bun.lock index bc09c53..3540803 100644 --- a/example/bun.lock +++ b/example/bun.lock @@ -25,7 +25,7 @@ "kleur": ["kleur@4.1.5", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="], - "pyre": ["pyre@file:..", { "dependencies": { "hype": "git+https://git.nose.space/defunkt/hype" }, "devDependencies": { "@types/bun": "latest" }, "peerDependencies": { "hono": "*", "typescript": "^5" } }], + "pyre": ["pyre@file:..", { "dependencies": { "hype": "git+https://git.nose.space/defunkt/hype" }, "devDependencies": { "@types/bun": "latest" }, "peerDependencies": { "typescript": "^5" } }], "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], diff --git a/package.json b/package.json index d553e1c..24cd697 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "module": "src/index.ts", "type": "module", "exports": { - "./client": "./src/client.ts", + "./client": "./src/client/index.ts", "./server": "./src/server/index.tsx" }, "devDependencies": { @@ -16,7 +16,6 @@ "hype": "git+https://git.nose.space/defunkt/hype" }, "scripts": { - "start": "bun run src/server/index.tsx", - "dev": "bun run --hot src/server/index.tsx" + "check": "bunx tsc --noEmit" } -} \ No newline at end of file +} diff --git a/src/client.ts b/src/client.ts deleted file mode 100644 index 5111dc7..0000000 --- a/src/client.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { setup } from '#setup' -export { send, gameId } from '#websocket' -export { sessionId } from '#session' diff --git a/src/client/index.ts b/src/client/index.ts new file mode 100644 index 0000000..c2070fd --- /dev/null +++ b/src/client/index.ts @@ -0,0 +1,3 @@ +export { setup } from './setup' +export { send, gameId } from './websocket' +export { sessionId } from './session' diff --git a/src/client/setup.ts b/src/client/setup.ts index b312919..db9b9c8 100644 --- a/src/client/setup.ts +++ b/src/client/setup.ts @@ -1,4 +1,4 @@ -import { initWebsocket, onUpdate } from '#websocket' +import { initWebsocket, onUpdate } from './websocket' export function setup(onRender: (game: G | undefined) => void) { let game: G | undefined = undefined diff --git a/src/client/websocket.ts b/src/client/websocket.ts index f5b436e..38ae168 100644 --- a/src/client/websocket.ts +++ b/src/client/websocket.ts @@ -1,5 +1,5 @@ -import type { Message } from '@types' -import { sessionId } from '#session' +import type { Message } from '../shared/types' +import { sessionId } from './session' const MAX_RETRIES = 5 let retries = 0 diff --git a/src/server/action.ts b/src/server/action.ts index 95fa754..d1830fc 100644 --- a/src/server/action.ts +++ b/src/server/action.ts @@ -1,5 +1,5 @@ -import type { Message } from '@types' -import { send, sendTo } from '$websocket' +import type { Message } from '../shared/types' +import { send, sendTo } from './websocket' // set by setup, called by server export let dispatch = (ws: any, msg: Message) => { } diff --git a/src/server/actionCodegen.ts b/src/server/actionCodegen.ts index 953024d..72e9b88 100644 --- a/src/server/actionCodegen.ts +++ b/src/server/actionCodegen.ts @@ -1,8 +1,8 @@ import { writeFileSync as writeFile, readFileSync as readFile, existsSync as exists } from 'fs' import { watch } from 'fs' import { join } from 'path' -import { parseActions } from '$actionParser' -import { normalize } from '$action' +import { parseActions } from './actionParser' +import { normalize } from './action' const srcDir = join(process.cwd(), 'src') diff --git a/src/server/index.tsx b/src/server/index.tsx index c57c926..1acb738 100644 --- a/src/server/index.tsx +++ b/src/server/index.tsx @@ -1,14 +1,14 @@ import { upgradeWebSocket, websocket } from 'hono/bun' import { Hype } from 'hype' -import type { Message } from '@types' -import { send, addWebsocket, removeWebsocket, closeWebsockets } from '$websocket' -import { dispatch, onPart } from '$action' +import type { Message } from '../shared/types' +import { send, addWebsocket, removeWebsocket, closeWebsockets } from './websocket' +import { dispatch, onPart } from './action' import IndexPage from '../pages/index' -export { setup } from '$action' -export type { Context } from '$action' +export { setup } from './action' +export type { Context } from './action' -import '$actionCodegen' +import './actionCodegen' const app = new Hype({ layout: false }) diff --git a/src/server/websocket.ts b/src/server/websocket.ts index 10ada17..1141d71 100644 --- a/src/server/websocket.ts +++ b/src/server/websocket.ts @@ -1,4 +1,4 @@ -import type { Message } from '@types' +import type { Message } from '../shared/types' const wsConnections = new Map() diff --git a/tsconfig.json b/tsconfig.json index 1c47734..a7b8d55 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,11 +19,6 @@ "noUnusedLocals": false, "noUnusedParameters": false, "noPropertyAccessFromIndexSignature": false, - "baseUrl": ".", - "paths": { - "$*": ["src/server/*"], - "#*": ["src/client/*"], - "@*": ["src/shared/*"] - } + "baseUrl": "." } }