Skip to content

Commit e279aa3

Browse files
committed
fix(examples): use explicit .ts extensions on relative imports
Node native ESM (bin.mjs -> src/devframe.ts) doesn't auto-resolve directory or extension-less imports — only the bundler-backed test harness did. Add explicit .ts extensions so the playwright e2e webserver can boot the examples.
1 parent d56cee4 commit e279aa3

11 files changed

Lines changed: 23 additions & 23 deletions

File tree

examples/files-inspector/src/devframe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { fileURLToPath } from 'node:url'
22
import { defineDevframe } from 'devframe/types'
3-
import { serverFunctions } from './rpc'
3+
import { serverFunctions } from './rpc/index.ts'
44

55
const BASE_PATH = '/__devframe-files-inspector/'
66
const distDir = fileURLToPath(new URL('../dist/client', import.meta.url))

examples/files-inspector/src/rpc/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { RpcDefinitionsToFunctions } from 'devframe/rpc'
2-
import { getCwd } from './functions/get-cwd'
3-
import { listFiles } from './functions/list-files'
2+
import { getCwd } from './functions/get-cwd.ts'
3+
import { listFiles } from './functions/list-files.ts'
44

55
export const serverFunctions = [getCwd, listFiles] as const
66

examples/next-runtime-snapshot/src/devframe.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { fileURLToPath } from 'node:url'
22
import { defineDevframe } from 'devframe/types'
3-
import { serverFunctions } from './rpc'
3+
import { serverFunctions } from './rpc/index.ts'
44

5-
export type { EnvEntry, EnvSnapshot } from './rpc/functions/env'
6-
export type { MemorySnapshot } from './rpc/functions/memory'
7-
export type { SystemInfo } from './rpc/functions/system'
5+
export type { EnvEntry, EnvSnapshot } from './rpc/functions/env.ts'
6+
export type { MemorySnapshot } from './rpc/functions/memory.ts'
7+
export type { SystemInfo } from './rpc/functions/system.ts'
88

99
const BASE_PATH = '/__next-runtime-snapshot/'
1010
const distDir = fileURLToPath(new URL('../dist/client', import.meta.url))

examples/next-runtime-snapshot/src/rpc/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { RpcDefinitionsToFunctions } from 'devframe/rpc'
2-
import { env } from './functions/env'
3-
import { memory } from './functions/memory'
4-
import { system } from './functions/system'
2+
import { env } from './functions/env.ts'
3+
import { memory } from './functions/memory.ts'
4+
import { system } from './functions/system.ts'
55

66
export const serverFunctions = [system, memory, env] as const
77

examples/streaming-chat/src/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { DevToolsNodeContext, RpcStreamingChannel } from 'devframe/types'
22
import type { SharedState } from 'devframe/utils/shared-state'
3-
import type { ChatHistory } from './types'
3+
import type { ChatHistory } from './types.ts'
44

55
export interface StreamingChatContext {
66
channel: RpcStreamingChannel<string>

examples/streaming-chat/src/devframe.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { fileURLToPath } from 'node:url'
22
import { defineDevframe } from 'devframe/types'
3-
import { CHANNEL_NAME, HISTORY_KEY, MAX_HISTORY } from './constants'
4-
import { setStreamingChatContext } from './context'
5-
import { serverFunctions } from './rpc'
3+
import { CHANNEL_NAME, HISTORY_KEY, MAX_HISTORY } from './constants.ts'
4+
import { setStreamingChatContext } from './context.ts'
5+
import { serverFunctions } from './rpc/index.ts'
66

7-
export type { ChatHistory, ChatMessage } from './types'
7+
export type { ChatHistory, ChatMessage } from './types.ts'
88

99
const BASE_PATH = '/__devframe-streaming-chat/'
1010
const distDir = fileURLToPath(new URL('../dist/client', import.meta.url))

examples/streaming-chat/src/rpc/functions/clear.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineRpcFunction } from 'devframe'
2-
import { getStreamingChatContext } from '../../context'
2+
import { getStreamingChatContext } from '../../context.ts'
33

44
export const clear = defineRpcFunction({
55
name: 'devframe-streaming-chat:clear',

examples/streaming-chat/src/rpc/functions/demo-prompts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineRpcFunction } from 'devframe'
2-
import { DEMO_PROMPTS } from '../../constants'
2+
import { DEMO_PROMPTS } from '../../constants.ts'
33

44
export const demoPrompts = defineRpcFunction({
55
name: 'devframe-streaming-chat:demo-prompts',

examples/streaming-chat/src/rpc/functions/send.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { defineRpcFunction } from 'devframe'
22
import { nanoid } from 'devframe/utils/nanoid'
33
import * as v from 'valibot'
4-
import { HISTORY_KEY } from '../../constants'
5-
import { getStreamingChatContext } from '../../context'
4+
import { HISTORY_KEY } from '../../constants.ts'
5+
import { getStreamingChatContext } from '../../context.ts'
66

77
/**
88
* Synthetic "AI" — splits a canned response into tokens and emits them

examples/streaming-chat/src/rpc/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { RpcDefinitionsToFunctions } from 'devframe/rpc'
2-
import { clear } from './functions/clear'
3-
import { demoPrompts } from './functions/demo-prompts'
4-
import { send } from './functions/send'
2+
import { clear } from './functions/clear.ts'
3+
import { demoPrompts } from './functions/demo-prompts.ts'
4+
import { send } from './functions/send.ts'
55

66
export const serverFunctions = [demoPrompts, send, clear] as const
77

0 commit comments

Comments
 (0)