From bb45c36a521b951aaa73c8f97998bc0bbd93f696 Mon Sep 17 00:00:00 2001 From: unnoq Date: Wed, 10 Sep 2025 12:59:43 +0700 Subject: [PATCH 1/2] docs: `router` -> `routers` folder --- apps/content/docs/adapters/electron.md | 1 - apps/content/docs/migrations/from-trpc.md | 4 ++-- playgrounds/astro/src/lib/orpc.ts | 2 +- playgrounds/astro/src/pages/api/[...rest].ts | 2 +- playgrounds/astro/src/pages/rpc/[...rest].ts | 2 +- playgrounds/astro/src/{router => routers}/auth.ts | 0 playgrounds/astro/src/{router => routers}/index.ts | 0 playgrounds/astro/src/{router => routers}/planet.ts | 0 playgrounds/astro/src/{router => routers}/sse.ts | 0 playgrounds/browser-extension/entrypoints/background/index.ts | 2 +- .../entrypoints/background/{router => routers}/auth.ts | 0 .../entrypoints/background/{router => routers}/index.ts | 0 .../entrypoints/background/{router => routers}/planet.ts | 0 .../entrypoints/background/{router => routers}/sse.ts | 0 playgrounds/browser-extension/entrypoints/popup/lib/orpc.ts | 2 +- playgrounds/bun-websocket-otel/src/index.tsx | 2 +- playgrounds/bun-websocket-otel/src/lib/orpc.ts | 2 +- .../bun-websocket-otel/src/{router => routers}/auth.ts | 0 .../bun-websocket-otel/src/{router => routers}/index.ts | 0 .../bun-websocket-otel/src/{router => routers}/planet.ts | 0 playgrounds/bun-websocket-otel/src/{router => routers}/sse.ts | 0 playgrounds/cloudflare-worker/src/lib/orpc.ts | 2 +- playgrounds/cloudflare-worker/worker/index.ts | 2 +- .../cloudflare-worker/worker/{router => routers}/auth.ts | 0 .../cloudflare-worker/worker/{router => routers}/index.ts | 0 .../cloudflare-worker/worker/{router => routers}/message.ts | 0 .../cloudflare-worker/worker/{router => routers}/planet.ts | 0 .../cloudflare-worker/worker/{router => routers}/sse.ts | 0 playgrounds/contract-first/src/main.ts | 2 +- playgrounds/contract-first/src/{router => routers}/auth.ts | 0 playgrounds/contract-first/src/{router => routers}/index.ts | 0 playgrounds/contract-first/src/{router => routers}/planet.ts | 0 playgrounds/contract-first/src/{router => routers}/sse.ts | 0 playgrounds/electron/src/main/index.ts | 2 +- playgrounds/electron/src/main/{router => routers}/auth.ts | 0 playgrounds/electron/src/main/{router => routers}/index.ts | 0 playgrounds/electron/src/main/{router => routers}/planet.ts | 0 playgrounds/electron/src/main/{router => routers}/sse.ts | 0 playgrounds/electron/src/renderer/src/lib/orpc.ts | 2 +- playgrounds/next/src/app/api/[[...rest]]/route.ts | 2 +- playgrounds/next/src/app/rpc/[[...rest]]/route.ts | 2 +- playgrounds/next/src/lib/orpc.server.ts | 2 +- playgrounds/next/src/lib/orpc.ts | 2 +- playgrounds/next/src/{router => routers}/auth.ts | 0 playgrounds/next/src/{router => routers}/index.ts | 0 playgrounds/next/src/{router => routers}/planet.ts | 0 playgrounds/next/src/{router => routers}/sse.ts | 0 playgrounds/nuxt/plugins/orpc.client.ts | 2 +- playgrounds/nuxt/plugins/orpc.server.ts | 2 +- playgrounds/nuxt/server/{router => routers}/auth.ts | 0 playgrounds/nuxt/server/{router => routers}/index.ts | 0 playgrounds/nuxt/server/{router => routers}/planet.ts | 0 playgrounds/nuxt/server/{router => routers}/sse.ts | 0 playgrounds/nuxt/server/routes/api/[...].ts | 2 +- playgrounds/nuxt/server/routes/rpc/[...].ts | 2 +- playgrounds/solid-start/src/lib/orpc.server.ts | 2 +- playgrounds/solid-start/src/lib/orpc.ts | 2 +- playgrounds/solid-start/src/{router => routers}/auth.ts | 0 playgrounds/solid-start/src/{router => routers}/index.ts | 0 playgrounds/solid-start/src/{router => routers}/planet.ts | 0 playgrounds/solid-start/src/{router => routers}/sse.ts | 0 playgrounds/solid-start/src/routes/api/[...rest].ts | 2 +- playgrounds/solid-start/src/routes/rpc/[...rest].ts | 2 +- playgrounds/svelte-kit/src/lib/orpc.ts | 2 +- playgrounds/svelte-kit/src/{router => routers}/auth.ts | 0 playgrounds/svelte-kit/src/{router => routers}/index.ts | 0 playgrounds/svelte-kit/src/{router => routers}/planet.ts | 0 playgrounds/svelte-kit/src/{router => routers}/sse.ts | 0 playgrounds/svelte-kit/src/routes/api/[...rest]/+server.ts | 2 +- playgrounds/svelte-kit/src/routes/rpc/[...rest]/+server.ts | 2 +- playgrounds/tanstack-start/src/lib/orpc.ts | 2 +- playgrounds/tanstack-start/src/{router => routers}/auth.ts | 0 playgrounds/tanstack-start/src/{router => routers}/index.ts | 0 playgrounds/tanstack-start/src/{router => routers}/planet.ts | 0 playgrounds/tanstack-start/src/{router => routers}/sse.ts | 0 playgrounds/tanstack-start/src/routes/api/$.ts | 2 +- playgrounds/tanstack-start/src/routes/api/rpc.$.ts | 2 +- 77 files changed, 32 insertions(+), 33 deletions(-) rename playgrounds/astro/src/{router => routers}/auth.ts (100%) rename playgrounds/astro/src/{router => routers}/index.ts (100%) rename playgrounds/astro/src/{router => routers}/planet.ts (100%) rename playgrounds/astro/src/{router => routers}/sse.ts (100%) rename playgrounds/browser-extension/entrypoints/background/{router => routers}/auth.ts (100%) rename playgrounds/browser-extension/entrypoints/background/{router => routers}/index.ts (100%) rename playgrounds/browser-extension/entrypoints/background/{router => routers}/planet.ts (100%) rename playgrounds/browser-extension/entrypoints/background/{router => routers}/sse.ts (100%) rename playgrounds/bun-websocket-otel/src/{router => routers}/auth.ts (100%) rename playgrounds/bun-websocket-otel/src/{router => routers}/index.ts (100%) rename playgrounds/bun-websocket-otel/src/{router => routers}/planet.ts (100%) rename playgrounds/bun-websocket-otel/src/{router => routers}/sse.ts (100%) rename playgrounds/cloudflare-worker/worker/{router => routers}/auth.ts (100%) rename playgrounds/cloudflare-worker/worker/{router => routers}/index.ts (100%) rename playgrounds/cloudflare-worker/worker/{router => routers}/message.ts (100%) rename playgrounds/cloudflare-worker/worker/{router => routers}/planet.ts (100%) rename playgrounds/cloudflare-worker/worker/{router => routers}/sse.ts (100%) rename playgrounds/contract-first/src/{router => routers}/auth.ts (100%) rename playgrounds/contract-first/src/{router => routers}/index.ts (100%) rename playgrounds/contract-first/src/{router => routers}/planet.ts (100%) rename playgrounds/contract-first/src/{router => routers}/sse.ts (100%) rename playgrounds/electron/src/main/{router => routers}/auth.ts (100%) rename playgrounds/electron/src/main/{router => routers}/index.ts (100%) rename playgrounds/electron/src/main/{router => routers}/planet.ts (100%) rename playgrounds/electron/src/main/{router => routers}/sse.ts (100%) rename playgrounds/next/src/{router => routers}/auth.ts (100%) rename playgrounds/next/src/{router => routers}/index.ts (100%) rename playgrounds/next/src/{router => routers}/planet.ts (100%) rename playgrounds/next/src/{router => routers}/sse.ts (100%) rename playgrounds/nuxt/server/{router => routers}/auth.ts (100%) rename playgrounds/nuxt/server/{router => routers}/index.ts (100%) rename playgrounds/nuxt/server/{router => routers}/planet.ts (100%) rename playgrounds/nuxt/server/{router => routers}/sse.ts (100%) rename playgrounds/solid-start/src/{router => routers}/auth.ts (100%) rename playgrounds/solid-start/src/{router => routers}/index.ts (100%) rename playgrounds/solid-start/src/{router => routers}/planet.ts (100%) rename playgrounds/solid-start/src/{router => routers}/sse.ts (100%) rename playgrounds/svelte-kit/src/{router => routers}/auth.ts (100%) rename playgrounds/svelte-kit/src/{router => routers}/index.ts (100%) rename playgrounds/svelte-kit/src/{router => routers}/planet.ts (100%) rename playgrounds/svelte-kit/src/{router => routers}/sse.ts (100%) rename playgrounds/tanstack-start/src/{router => routers}/auth.ts (100%) rename playgrounds/tanstack-start/src/{router => routers}/index.ts (100%) rename playgrounds/tanstack-start/src/{router => routers}/planet.ts (100%) rename playgrounds/tanstack-start/src/{router => routers}/sse.ts (100%) diff --git a/apps/content/docs/adapters/electron.md b/apps/content/docs/adapters/electron.md index f87422332..bc61f5511 100644 --- a/apps/content/docs/adapters/electron.md +++ b/apps/content/docs/adapters/electron.md @@ -13,7 +13,6 @@ Listen for a port sent from the renderer, then upgrade it: ```ts import { RPCHandler } from '@orpc/server/message-port' -import { router } from './router' const handler = new RPCHandler(router) diff --git a/apps/content/docs/migrations/from-trpc.md b/apps/content/docs/migrations/from-trpc.md index 221216006..ad8a2a6c0 100644 --- a/apps/content/docs/migrations/from-trpc.md +++ b/apps/content/docs/migrations/from-trpc.md @@ -239,7 +239,7 @@ The main router structure is similar between tRPC and oRPC, except in oRPC you d ::: code-group -```ts [orpc/router/index.ts] +```ts [orpc/routers/index.ts] import { planetRouter } from './planet' export const appRouter = { @@ -247,7 +247,7 @@ export const appRouter = { } ``` -```ts [trpc/router/index.ts] +```ts [trpc/routers/index.ts] import { planetRouter } from './planet' export const appRouter = createTRPCRouter({ diff --git a/playgrounds/astro/src/lib/orpc.ts b/playgrounds/astro/src/lib/orpc.ts index 48e0eb9c6..060f6020f 100644 --- a/playgrounds/astro/src/lib/orpc.ts +++ b/playgrounds/astro/src/lib/orpc.ts @@ -1,4 +1,4 @@ -import type { router } from '../router' +import type { router } from '../routers' import type { RouterClient } from '@orpc/server' import { createORPCClient } from '@orpc/client' import { RPCLink } from '@orpc/client/fetch' diff --git a/playgrounds/astro/src/pages/api/[...rest].ts b/playgrounds/astro/src/pages/api/[...rest].ts index 2e49d8bd8..5aa8322ad 100644 --- a/playgrounds/astro/src/pages/api/[...rest].ts +++ b/playgrounds/astro/src/pages/api/[...rest].ts @@ -4,7 +4,7 @@ import { onError } from '@orpc/server' import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4' import { experimental_SmartCoercionPlugin as SmartCoercionPlugin } from '@orpc/json-schema' import { OpenAPIReferencePlugin } from '@orpc/openapi/plugins' -import { router } from '../../router' +import { router } from '../../routers' import type { APIRoute } from 'astro' import { NewUserSchema, UserSchema } from '../../schemas/user' import { CredentialSchema, TokenSchema } from '../../schemas/auth' diff --git a/playgrounds/astro/src/pages/rpc/[...rest].ts b/playgrounds/astro/src/pages/rpc/[...rest].ts index 9f459b378..91241b448 100644 --- a/playgrounds/astro/src/pages/rpc/[...rest].ts +++ b/playgrounds/astro/src/pages/rpc/[...rest].ts @@ -3,7 +3,7 @@ import type { APIRoute } from 'astro' import { onError } from '@orpc/server' import { BatchHandlerPlugin } from '@orpc/server/plugins' import { RPCHandler } from '@orpc/server/fetch' -import { router } from '../../router' +import { router } from '../../routers' const handler = new RPCHandler(router, { interceptors: [ diff --git a/playgrounds/astro/src/router/auth.ts b/playgrounds/astro/src/routers/auth.ts similarity index 100% rename from playgrounds/astro/src/router/auth.ts rename to playgrounds/astro/src/routers/auth.ts diff --git a/playgrounds/astro/src/router/index.ts b/playgrounds/astro/src/routers/index.ts similarity index 100% rename from playgrounds/astro/src/router/index.ts rename to playgrounds/astro/src/routers/index.ts diff --git a/playgrounds/astro/src/router/planet.ts b/playgrounds/astro/src/routers/planet.ts similarity index 100% rename from playgrounds/astro/src/router/planet.ts rename to playgrounds/astro/src/routers/planet.ts diff --git a/playgrounds/astro/src/router/sse.ts b/playgrounds/astro/src/routers/sse.ts similarity index 100% rename from playgrounds/astro/src/router/sse.ts rename to playgrounds/astro/src/routers/sse.ts diff --git a/playgrounds/browser-extension/entrypoints/background/index.ts b/playgrounds/browser-extension/entrypoints/background/index.ts index d6c6a5a17..825fc75c5 100644 --- a/playgrounds/browser-extension/entrypoints/background/index.ts +++ b/playgrounds/browser-extension/entrypoints/background/index.ts @@ -1,5 +1,5 @@ import { RPCHandler } from '@orpc/server/message-port' -import { router } from './router' +import { router } from './routers' const handler = new RPCHandler(router) diff --git a/playgrounds/browser-extension/entrypoints/background/router/auth.ts b/playgrounds/browser-extension/entrypoints/background/routers/auth.ts similarity index 100% rename from playgrounds/browser-extension/entrypoints/background/router/auth.ts rename to playgrounds/browser-extension/entrypoints/background/routers/auth.ts diff --git a/playgrounds/browser-extension/entrypoints/background/router/index.ts b/playgrounds/browser-extension/entrypoints/background/routers/index.ts similarity index 100% rename from playgrounds/browser-extension/entrypoints/background/router/index.ts rename to playgrounds/browser-extension/entrypoints/background/routers/index.ts diff --git a/playgrounds/browser-extension/entrypoints/background/router/planet.ts b/playgrounds/browser-extension/entrypoints/background/routers/planet.ts similarity index 100% rename from playgrounds/browser-extension/entrypoints/background/router/planet.ts rename to playgrounds/browser-extension/entrypoints/background/routers/planet.ts diff --git a/playgrounds/browser-extension/entrypoints/background/router/sse.ts b/playgrounds/browser-extension/entrypoints/background/routers/sse.ts similarity index 100% rename from playgrounds/browser-extension/entrypoints/background/router/sse.ts rename to playgrounds/browser-extension/entrypoints/background/routers/sse.ts diff --git a/playgrounds/browser-extension/entrypoints/popup/lib/orpc.ts b/playgrounds/browser-extension/entrypoints/popup/lib/orpc.ts index 9b23a11fe..890f7dc94 100644 --- a/playgrounds/browser-extension/entrypoints/popup/lib/orpc.ts +++ b/playgrounds/browser-extension/entrypoints/popup/lib/orpc.ts @@ -1,4 +1,4 @@ -import type { router } from '../.../../../background/router' +import type { router } from '../.../../../background/routers' import type { RouterClient } from '@orpc/server' import { createORPCClient } from '@orpc/client' import { RPCLink } from '@orpc/client/message-port' diff --git a/playgrounds/bun-websocket-otel/src/index.tsx b/playgrounds/bun-websocket-otel/src/index.tsx index f33681a5c..9d497bdce 100644 --- a/playgrounds/bun-websocket-otel/src/index.tsx +++ b/playgrounds/bun-websocket-otel/src/index.tsx @@ -2,7 +2,7 @@ import './instrumentation' import { serve } from 'bun' import index from './index.html' -import { router } from './router' +import { router } from './routers' import { RPCHandler } from '@orpc/server/bun-ws' import { OTEL_TRACE_EXPORTER_URL } from './consts' import { trace } from '@opentelemetry/api' diff --git a/playgrounds/bun-websocket-otel/src/lib/orpc.ts b/playgrounds/bun-websocket-otel/src/lib/orpc.ts index a224c48ae..778add3e8 100644 --- a/playgrounds/bun-websocket-otel/src/lib/orpc.ts +++ b/playgrounds/bun-websocket-otel/src/lib/orpc.ts @@ -1,5 +1,5 @@ import type { RouterClient } from '@orpc/server' -import type { router } from '../router' +import type { router } from '../routers' import { createORPCClient } from '@orpc/client' import { RPCLink } from '@orpc/client/websocket' import { createTanstackQueryUtils } from '@orpc/tanstack-query' diff --git a/playgrounds/bun-websocket-otel/src/router/auth.ts b/playgrounds/bun-websocket-otel/src/routers/auth.ts similarity index 100% rename from playgrounds/bun-websocket-otel/src/router/auth.ts rename to playgrounds/bun-websocket-otel/src/routers/auth.ts diff --git a/playgrounds/bun-websocket-otel/src/router/index.ts b/playgrounds/bun-websocket-otel/src/routers/index.ts similarity index 100% rename from playgrounds/bun-websocket-otel/src/router/index.ts rename to playgrounds/bun-websocket-otel/src/routers/index.ts diff --git a/playgrounds/bun-websocket-otel/src/router/planet.ts b/playgrounds/bun-websocket-otel/src/routers/planet.ts similarity index 100% rename from playgrounds/bun-websocket-otel/src/router/planet.ts rename to playgrounds/bun-websocket-otel/src/routers/planet.ts diff --git a/playgrounds/bun-websocket-otel/src/router/sse.ts b/playgrounds/bun-websocket-otel/src/routers/sse.ts similarity index 100% rename from playgrounds/bun-websocket-otel/src/router/sse.ts rename to playgrounds/bun-websocket-otel/src/routers/sse.ts diff --git a/playgrounds/cloudflare-worker/src/lib/orpc.ts b/playgrounds/cloudflare-worker/src/lib/orpc.ts index 0961515e3..c7819009b 100644 --- a/playgrounds/cloudflare-worker/src/lib/orpc.ts +++ b/playgrounds/cloudflare-worker/src/lib/orpc.ts @@ -3,7 +3,7 @@ import { RPCLink } from '@orpc/client/fetch' import { DurableEventIteratorLinkPlugin } from '@orpc/experimental-durable-event-iterator/client' import type { RouterClient } from '@orpc/server' import { createTanstackQueryUtils } from '@orpc/tanstack-query' -import type { router } from '../../worker/router' +import type { router } from '../../worker/routers' const link = new RPCLink({ url: `${window.location.origin}/rpc`, diff --git a/playgrounds/cloudflare-worker/worker/index.ts b/playgrounds/cloudflare-worker/worker/index.ts index 3b96a305b..e2df7162c 100644 --- a/playgrounds/cloudflare-worker/worker/index.ts +++ b/playgrounds/cloudflare-worker/worker/index.ts @@ -4,7 +4,7 @@ import { OpenAPIReferencePlugin } from '@orpc/openapi/plugins' import { experimental_SmartCoercionPlugin as SmartCoercionPlugin } from '@orpc/json-schema' import { upgradeDurableEventIteratorRequest } from '@orpc/experimental-durable-event-iterator/durable-object' import { BatchHandlerPlugin } from '@orpc/server/plugins' -import { router } from './router' +import { router } from './routers' import { onError } from '@orpc/client' import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4' import { NewUserSchema, UserSchema } from './schemas/user' diff --git a/playgrounds/cloudflare-worker/worker/router/auth.ts b/playgrounds/cloudflare-worker/worker/routers/auth.ts similarity index 100% rename from playgrounds/cloudflare-worker/worker/router/auth.ts rename to playgrounds/cloudflare-worker/worker/routers/auth.ts diff --git a/playgrounds/cloudflare-worker/worker/router/index.ts b/playgrounds/cloudflare-worker/worker/routers/index.ts similarity index 100% rename from playgrounds/cloudflare-worker/worker/router/index.ts rename to playgrounds/cloudflare-worker/worker/routers/index.ts diff --git a/playgrounds/cloudflare-worker/worker/router/message.ts b/playgrounds/cloudflare-worker/worker/routers/message.ts similarity index 100% rename from playgrounds/cloudflare-worker/worker/router/message.ts rename to playgrounds/cloudflare-worker/worker/routers/message.ts diff --git a/playgrounds/cloudflare-worker/worker/router/planet.ts b/playgrounds/cloudflare-worker/worker/routers/planet.ts similarity index 100% rename from playgrounds/cloudflare-worker/worker/router/planet.ts rename to playgrounds/cloudflare-worker/worker/routers/planet.ts diff --git a/playgrounds/cloudflare-worker/worker/router/sse.ts b/playgrounds/cloudflare-worker/worker/routers/sse.ts similarity index 100% rename from playgrounds/cloudflare-worker/worker/router/sse.ts rename to playgrounds/cloudflare-worker/worker/routers/sse.ts diff --git a/playgrounds/contract-first/src/main.ts b/playgrounds/contract-first/src/main.ts index 630bdc86f..c76df5925 100644 --- a/playgrounds/contract-first/src/main.ts +++ b/playgrounds/contract-first/src/main.ts @@ -4,7 +4,7 @@ import { onError } from '@orpc/server' import { RPCHandler } from '@orpc/server/node' import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4' import { experimental_SmartCoercionPlugin as SmartCoercionPlugin } from '@orpc/json-schema' -import { router } from './router' +import { router } from './routers' import { OpenAPIReferencePlugin } from '@orpc/openapi/plugins' import './polyfill' import { NewUserSchema, UserSchema } from './schemas/user' diff --git a/playgrounds/contract-first/src/router/auth.ts b/playgrounds/contract-first/src/routers/auth.ts similarity index 100% rename from playgrounds/contract-first/src/router/auth.ts rename to playgrounds/contract-first/src/routers/auth.ts diff --git a/playgrounds/contract-first/src/router/index.ts b/playgrounds/contract-first/src/routers/index.ts similarity index 100% rename from playgrounds/contract-first/src/router/index.ts rename to playgrounds/contract-first/src/routers/index.ts diff --git a/playgrounds/contract-first/src/router/planet.ts b/playgrounds/contract-first/src/routers/planet.ts similarity index 100% rename from playgrounds/contract-first/src/router/planet.ts rename to playgrounds/contract-first/src/routers/planet.ts diff --git a/playgrounds/contract-first/src/router/sse.ts b/playgrounds/contract-first/src/routers/sse.ts similarity index 100% rename from playgrounds/contract-first/src/router/sse.ts rename to playgrounds/contract-first/src/routers/sse.ts diff --git a/playgrounds/electron/src/main/index.ts b/playgrounds/electron/src/main/index.ts index 714a139fa..b624b55bf 100644 --- a/playgrounds/electron/src/main/index.ts +++ b/playgrounds/electron/src/main/index.ts @@ -2,7 +2,7 @@ import { app, BrowserWindow, ipcMain, shell } from 'electron' import { join } from 'node:path' import { electronApp, is, optimizer } from '@electron-toolkit/utils' import { RPCHandler } from '@orpc/server/message-port' -import { router } from './router' +import { router } from './routers' function createWindow(): void { // Create the browser window. diff --git a/playgrounds/electron/src/main/router/auth.ts b/playgrounds/electron/src/main/routers/auth.ts similarity index 100% rename from playgrounds/electron/src/main/router/auth.ts rename to playgrounds/electron/src/main/routers/auth.ts diff --git a/playgrounds/electron/src/main/router/index.ts b/playgrounds/electron/src/main/routers/index.ts similarity index 100% rename from playgrounds/electron/src/main/router/index.ts rename to playgrounds/electron/src/main/routers/index.ts diff --git a/playgrounds/electron/src/main/router/planet.ts b/playgrounds/electron/src/main/routers/planet.ts similarity index 100% rename from playgrounds/electron/src/main/router/planet.ts rename to playgrounds/electron/src/main/routers/planet.ts diff --git a/playgrounds/electron/src/main/router/sse.ts b/playgrounds/electron/src/main/routers/sse.ts similarity index 100% rename from playgrounds/electron/src/main/router/sse.ts rename to playgrounds/electron/src/main/routers/sse.ts diff --git a/playgrounds/electron/src/renderer/src/lib/orpc.ts b/playgrounds/electron/src/renderer/src/lib/orpc.ts index 69c3b588b..3310d3736 100644 --- a/playgrounds/electron/src/renderer/src/lib/orpc.ts +++ b/playgrounds/electron/src/renderer/src/lib/orpc.ts @@ -1,4 +1,4 @@ -import type { router } from '../../../main/router' +import type { router } from '../../../main/routers' import type { RouterClient } from '@orpc/server' import { createORPCClient } from '@orpc/client' import { RPCLink } from '@orpc/client/message-port' diff --git a/playgrounds/next/src/app/api/[[...rest]]/route.ts b/playgrounds/next/src/app/api/[[...rest]]/route.ts index 44de38448..1a529cd40 100644 --- a/playgrounds/next/src/app/api/[[...rest]]/route.ts +++ b/playgrounds/next/src/app/api/[[...rest]]/route.ts @@ -1,4 +1,4 @@ -import { router } from '@/router' +import { router } from '@/routers' import { OpenAPIHandler } from '@orpc/openapi/fetch' import { onError } from '@orpc/server' import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4' diff --git a/playgrounds/next/src/app/rpc/[[...rest]]/route.ts b/playgrounds/next/src/app/rpc/[[...rest]]/route.ts index 3eccf1bf3..a921d5d04 100644 --- a/playgrounds/next/src/app/rpc/[[...rest]]/route.ts +++ b/playgrounds/next/src/app/rpc/[[...rest]]/route.ts @@ -1,4 +1,4 @@ -import { router } from '@/router' +import { router } from '@/routers' import { onError } from '@orpc/server' import { BatchHandlerPlugin } from '@orpc/server/plugins' import { RPCHandler } from '@orpc/server/fetch' diff --git a/playgrounds/next/src/lib/orpc.server.ts b/playgrounds/next/src/lib/orpc.server.ts index d422f5305..904195ce5 100644 --- a/playgrounds/next/src/lib/orpc.server.ts +++ b/playgrounds/next/src/lib/orpc.server.ts @@ -1,6 +1,6 @@ import 'server-only' -import { router } from '@/router' +import { router } from '@/routers' import { createRouterClient } from '@orpc/server' import { headers } from 'next/headers' diff --git a/playgrounds/next/src/lib/orpc.ts b/playgrounds/next/src/lib/orpc.ts index 508b0096e..d7086cf15 100644 --- a/playgrounds/next/src/lib/orpc.ts +++ b/playgrounds/next/src/lib/orpc.ts @@ -1,4 +1,4 @@ -import type { router } from '@/router' +import type { router } from '@/routers' import type { RouterClient } from '@orpc/server' import { createORPCClient } from '@orpc/client' import { RPCLink } from '@orpc/client/fetch' diff --git a/playgrounds/next/src/router/auth.ts b/playgrounds/next/src/routers/auth.ts similarity index 100% rename from playgrounds/next/src/router/auth.ts rename to playgrounds/next/src/routers/auth.ts diff --git a/playgrounds/next/src/router/index.ts b/playgrounds/next/src/routers/index.ts similarity index 100% rename from playgrounds/next/src/router/index.ts rename to playgrounds/next/src/routers/index.ts diff --git a/playgrounds/next/src/router/planet.ts b/playgrounds/next/src/routers/planet.ts similarity index 100% rename from playgrounds/next/src/router/planet.ts rename to playgrounds/next/src/routers/planet.ts diff --git a/playgrounds/next/src/router/sse.ts b/playgrounds/next/src/routers/sse.ts similarity index 100% rename from playgrounds/next/src/router/sse.ts rename to playgrounds/next/src/routers/sse.ts diff --git a/playgrounds/nuxt/plugins/orpc.client.ts b/playgrounds/nuxt/plugins/orpc.client.ts index dc5109be5..c232ea2d5 100644 --- a/playgrounds/nuxt/plugins/orpc.client.ts +++ b/playgrounds/nuxt/plugins/orpc.client.ts @@ -1,5 +1,5 @@ import type { RouterClient } from '@orpc/server' -import type { router } from '~/server/router' +import type { router } from '~/server/routers' import { createORPCClient } from '@orpc/client' import { RPCLink } from '@orpc/client/fetch' import { createTanstackQueryUtils } from '@orpc/tanstack-query' diff --git a/playgrounds/nuxt/plugins/orpc.server.ts b/playgrounds/nuxt/plugins/orpc.server.ts index ed98f75fb..76fe0b489 100644 --- a/playgrounds/nuxt/plugins/orpc.server.ts +++ b/playgrounds/nuxt/plugins/orpc.server.ts @@ -1,5 +1,5 @@ import { createRouterClient } from '@orpc/server' -import { router } from '~/server/router' +import { router } from '~/server/routers' import { createTanstackQueryUtils } from '@orpc/tanstack-query' /** diff --git a/playgrounds/nuxt/server/router/auth.ts b/playgrounds/nuxt/server/routers/auth.ts similarity index 100% rename from playgrounds/nuxt/server/router/auth.ts rename to playgrounds/nuxt/server/routers/auth.ts diff --git a/playgrounds/nuxt/server/router/index.ts b/playgrounds/nuxt/server/routers/index.ts similarity index 100% rename from playgrounds/nuxt/server/router/index.ts rename to playgrounds/nuxt/server/routers/index.ts diff --git a/playgrounds/nuxt/server/router/planet.ts b/playgrounds/nuxt/server/routers/planet.ts similarity index 100% rename from playgrounds/nuxt/server/router/planet.ts rename to playgrounds/nuxt/server/routers/planet.ts diff --git a/playgrounds/nuxt/server/router/sse.ts b/playgrounds/nuxt/server/routers/sse.ts similarity index 100% rename from playgrounds/nuxt/server/router/sse.ts rename to playgrounds/nuxt/server/routers/sse.ts diff --git a/playgrounds/nuxt/server/routes/api/[...].ts b/playgrounds/nuxt/server/routes/api/[...].ts index 4fc23ba77..9a7b235fa 100644 --- a/playgrounds/nuxt/server/routes/api/[...].ts +++ b/playgrounds/nuxt/server/routes/api/[...].ts @@ -2,7 +2,7 @@ import { OpenAPIHandler } from '@orpc/openapi/node' import { onError } from '@orpc/server' import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4' import { experimental_SmartCoercionPlugin as SmartCoercionPlugin } from '@orpc/json-schema' -import { router } from '~/server/router' +import { router } from '~/server/routers' import { OpenAPIReferencePlugin } from '@orpc/openapi/plugins' import { NewUserSchema, UserSchema } from '~/server/schemas/user' import { CredentialSchema, TokenSchema } from '~/server/schemas/auth' diff --git a/playgrounds/nuxt/server/routes/rpc/[...].ts b/playgrounds/nuxt/server/routes/rpc/[...].ts index b90dcd187..542f0733c 100644 --- a/playgrounds/nuxt/server/routes/rpc/[...].ts +++ b/playgrounds/nuxt/server/routes/rpc/[...].ts @@ -1,6 +1,6 @@ import { onError } from '@orpc/server' import { RPCHandler } from '@orpc/server/node' -import { router } from '~/server/router' +import { router } from '~/server/routers' const rpcHandler = new RPCHandler(router, { interceptors: [ diff --git a/playgrounds/solid-start/src/lib/orpc.server.ts b/playgrounds/solid-start/src/lib/orpc.server.ts index 7ba941c89..a7742722a 100644 --- a/playgrounds/solid-start/src/lib/orpc.server.ts +++ b/playgrounds/solid-start/src/lib/orpc.server.ts @@ -1,6 +1,6 @@ import { createRouterClient } from '@orpc/server' import { getRequestEvent } from 'solid-js/web' -import { router } from '~/router' +import { router } from '~/routers' if (typeof window !== 'undefined') { throw new Error('This file should not be imported in the browser') diff --git a/playgrounds/solid-start/src/lib/orpc.ts b/playgrounds/solid-start/src/lib/orpc.ts index 32be646d0..00e3833a6 100644 --- a/playgrounds/solid-start/src/lib/orpc.ts +++ b/playgrounds/solid-start/src/lib/orpc.ts @@ -3,7 +3,7 @@ if (typeof window === 'undefined') { } import type { RouterClient } from '@orpc/server' -import type { router } from '~/router' +import type { router } from '~/routers' import { createORPCClient } from '@orpc/client' import { RPCLink } from '@orpc/client/fetch' import { createTanstackQueryUtils } from '@orpc/tanstack-query' diff --git a/playgrounds/solid-start/src/router/auth.ts b/playgrounds/solid-start/src/routers/auth.ts similarity index 100% rename from playgrounds/solid-start/src/router/auth.ts rename to playgrounds/solid-start/src/routers/auth.ts diff --git a/playgrounds/solid-start/src/router/index.ts b/playgrounds/solid-start/src/routers/index.ts similarity index 100% rename from playgrounds/solid-start/src/router/index.ts rename to playgrounds/solid-start/src/routers/index.ts diff --git a/playgrounds/solid-start/src/router/planet.ts b/playgrounds/solid-start/src/routers/planet.ts similarity index 100% rename from playgrounds/solid-start/src/router/planet.ts rename to playgrounds/solid-start/src/routers/planet.ts diff --git a/playgrounds/solid-start/src/router/sse.ts b/playgrounds/solid-start/src/routers/sse.ts similarity index 100% rename from playgrounds/solid-start/src/router/sse.ts rename to playgrounds/solid-start/src/routers/sse.ts diff --git a/playgrounds/solid-start/src/routes/api/[...rest].ts b/playgrounds/solid-start/src/routes/api/[...rest].ts index 421f2dd9e..bdad7d350 100644 --- a/playgrounds/solid-start/src/routes/api/[...rest].ts +++ b/playgrounds/solid-start/src/routes/api/[...rest].ts @@ -1,6 +1,6 @@ import type { APIEvent } from '@solidjs/start/server' import { OpenAPIHandler } from '@orpc/openapi/fetch' -import { router } from '~/router' +import { router } from '~/routers' import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4' import { experimental_SmartCoercionPlugin as SmartCoercionPlugin } from '@orpc/json-schema' import { onError } from '@orpc/server' diff --git a/playgrounds/solid-start/src/routes/rpc/[...rest].ts b/playgrounds/solid-start/src/routes/rpc/[...rest].ts index 084a5c5b8..97bd6775e 100644 --- a/playgrounds/solid-start/src/routes/rpc/[...rest].ts +++ b/playgrounds/solid-start/src/routes/rpc/[...rest].ts @@ -1,6 +1,6 @@ import type { APIEvent } from '@solidjs/start/server' import { RPCHandler } from '@orpc/server/fetch' -import { router } from '~/router' +import { router } from '~/routers' import { onError } from '@orpc/server' import '~/polyfill' diff --git a/playgrounds/svelte-kit/src/lib/orpc.ts b/playgrounds/svelte-kit/src/lib/orpc.ts index d76eeb1d3..7ea9a6959 100644 --- a/playgrounds/svelte-kit/src/lib/orpc.ts +++ b/playgrounds/svelte-kit/src/lib/orpc.ts @@ -1,5 +1,5 @@ import type { RouterClient } from '@orpc/server' -import type { router } from '../router' +import type { router } from '../routers' import { createORPCClient } from '@orpc/client' import { RPCLink } from '@orpc/client/fetch' import { createTanstackQueryUtils } from '@orpc/tanstack-query' diff --git a/playgrounds/svelte-kit/src/router/auth.ts b/playgrounds/svelte-kit/src/routers/auth.ts similarity index 100% rename from playgrounds/svelte-kit/src/router/auth.ts rename to playgrounds/svelte-kit/src/routers/auth.ts diff --git a/playgrounds/svelte-kit/src/router/index.ts b/playgrounds/svelte-kit/src/routers/index.ts similarity index 100% rename from playgrounds/svelte-kit/src/router/index.ts rename to playgrounds/svelte-kit/src/routers/index.ts diff --git a/playgrounds/svelte-kit/src/router/planet.ts b/playgrounds/svelte-kit/src/routers/planet.ts similarity index 100% rename from playgrounds/svelte-kit/src/router/planet.ts rename to playgrounds/svelte-kit/src/routers/planet.ts diff --git a/playgrounds/svelte-kit/src/router/sse.ts b/playgrounds/svelte-kit/src/routers/sse.ts similarity index 100% rename from playgrounds/svelte-kit/src/router/sse.ts rename to playgrounds/svelte-kit/src/routers/sse.ts diff --git a/playgrounds/svelte-kit/src/routes/api/[...rest]/+server.ts b/playgrounds/svelte-kit/src/routes/api/[...rest]/+server.ts index b1f237c33..5a1f97a6b 100644 --- a/playgrounds/svelte-kit/src/routes/api/[...rest]/+server.ts +++ b/playgrounds/svelte-kit/src/routes/api/[...rest]/+server.ts @@ -1,5 +1,5 @@ import { OpenAPIHandler } from '@orpc/openapi/fetch' -import { router } from '../../../router' +import { router } from '../../../routers' import { onError } from '@orpc/server' import type { RequestHandler } from '@sveltejs/kit' import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4' diff --git a/playgrounds/svelte-kit/src/routes/rpc/[...rest]/+server.ts b/playgrounds/svelte-kit/src/routes/rpc/[...rest]/+server.ts index da3c64011..663ebbd5c 100644 --- a/playgrounds/svelte-kit/src/routes/rpc/[...rest]/+server.ts +++ b/playgrounds/svelte-kit/src/routes/rpc/[...rest]/+server.ts @@ -1,5 +1,5 @@ import { RPCHandler } from '@orpc/server/fetch' -import { router } from '../../../router' +import { router } from '../../../routers' import { onError } from '@orpc/server' import type { RequestHandler } from '@sveltejs/kit' import '../../../polyfill' diff --git a/playgrounds/tanstack-start/src/lib/orpc.ts b/playgrounds/tanstack-start/src/lib/orpc.ts index aa2bbe5a6..2c1d739a7 100644 --- a/playgrounds/tanstack-start/src/lib/orpc.ts +++ b/playgrounds/tanstack-start/src/lib/orpc.ts @@ -1,4 +1,4 @@ -import { router } from '~/router/index' +import { router } from '~/routers' import { createRouterClient } from '@orpc/server' import type { RouterClient } from '@orpc/server' import { createORPCClient } from '@orpc/client' diff --git a/playgrounds/tanstack-start/src/router/auth.ts b/playgrounds/tanstack-start/src/routers/auth.ts similarity index 100% rename from playgrounds/tanstack-start/src/router/auth.ts rename to playgrounds/tanstack-start/src/routers/auth.ts diff --git a/playgrounds/tanstack-start/src/router/index.ts b/playgrounds/tanstack-start/src/routers/index.ts similarity index 100% rename from playgrounds/tanstack-start/src/router/index.ts rename to playgrounds/tanstack-start/src/routers/index.ts diff --git a/playgrounds/tanstack-start/src/router/planet.ts b/playgrounds/tanstack-start/src/routers/planet.ts similarity index 100% rename from playgrounds/tanstack-start/src/router/planet.ts rename to playgrounds/tanstack-start/src/routers/planet.ts diff --git a/playgrounds/tanstack-start/src/router/sse.ts b/playgrounds/tanstack-start/src/routers/sse.ts similarity index 100% rename from playgrounds/tanstack-start/src/router/sse.ts rename to playgrounds/tanstack-start/src/routers/sse.ts diff --git a/playgrounds/tanstack-start/src/routes/api/$.ts b/playgrounds/tanstack-start/src/routes/api/$.ts index fa20eca6e..6aa0bacc4 100644 --- a/playgrounds/tanstack-start/src/routes/api/$.ts +++ b/playgrounds/tanstack-start/src/routes/api/$.ts @@ -4,7 +4,7 @@ import { OpenAPIHandler } from '@orpc/openapi/fetch' import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4' import { experimental_SmartCoercionPlugin as SmartCoercionPlugin } from '@orpc/json-schema' import { createServerFileRoute } from '@tanstack/react-start/server' -import { router } from '~/router/index' +import { router } from '~/routers/index' import { onError } from '@orpc/server' import { OpenAPIReferencePlugin } from '@orpc/openapi/plugins' import { NewUserSchema, UserSchema } from '~/schemas/user' diff --git a/playgrounds/tanstack-start/src/routes/api/rpc.$.ts b/playgrounds/tanstack-start/src/routes/api/rpc.$.ts index d096c738d..e67eef2db 100644 --- a/playgrounds/tanstack-start/src/routes/api/rpc.$.ts +++ b/playgrounds/tanstack-start/src/routes/api/rpc.$.ts @@ -2,7 +2,7 @@ import '~/polyfill' import { RPCHandler } from '@orpc/server/fetch' import { createServerFileRoute } from '@tanstack/react-start/server' -import { router } from '~/router/index' +import { router } from '~/routers/index' const handler = new RPCHandler(router) From c558b19f63e0eed8e09bf74e862be64c88f73b4e Mon Sep 17 00:00:00 2001 From: unnoq Date: Wed, 10 Sep 2025 13:02:30 +0700 Subject: [PATCH 2/2] improve --- playgrounds/tanstack-start/src/routes/api/$.ts | 2 +- playgrounds/tanstack-start/src/routes/api/rpc.$.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/playgrounds/tanstack-start/src/routes/api/$.ts b/playgrounds/tanstack-start/src/routes/api/$.ts index 6aa0bacc4..12b724b0f 100644 --- a/playgrounds/tanstack-start/src/routes/api/$.ts +++ b/playgrounds/tanstack-start/src/routes/api/$.ts @@ -4,7 +4,7 @@ import { OpenAPIHandler } from '@orpc/openapi/fetch' import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4' import { experimental_SmartCoercionPlugin as SmartCoercionPlugin } from '@orpc/json-schema' import { createServerFileRoute } from '@tanstack/react-start/server' -import { router } from '~/routers/index' +import { router } from '~/routers' import { onError } from '@orpc/server' import { OpenAPIReferencePlugin } from '@orpc/openapi/plugins' import { NewUserSchema, UserSchema } from '~/schemas/user' diff --git a/playgrounds/tanstack-start/src/routes/api/rpc.$.ts b/playgrounds/tanstack-start/src/routes/api/rpc.$.ts index e67eef2db..50069578e 100644 --- a/playgrounds/tanstack-start/src/routes/api/rpc.$.ts +++ b/playgrounds/tanstack-start/src/routes/api/rpc.$.ts @@ -2,7 +2,7 @@ import '~/polyfill' import { RPCHandler } from '@orpc/server/fetch' import { createServerFileRoute } from '@tanstack/react-start/server' -import { router } from '~/routers/index' +import { router } from '~/routers' const handler = new RPCHandler(router)