fix(sdk): point exports to source and remove .js import suffixes

- Change package exports from dist/ to src/ (consistent with @multica/store and @multica/ui)
- Add private: true since SDK is an internal monorepo package
- Switch tsconfig from NodeNext to bundler moduleResolution
- Remove .js suffixes from all internal imports for Turbopack compatibility

Eliminates the need to build SDK before running dev server or Next.js build.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Naiyuan Qing 2026-02-02 16:58:23 +08:00
parent ebcab2477a
commit 441c2059a8
5 changed files with 13 additions and 18 deletions

View file

@ -2,14 +2,9 @@
"name": "@multica/sdk",
"version": "0.1.0",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"private": true,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.js"
},
".": "./src/index.ts",
"./*": "./src/*.ts"
},
"scripts": {

View file

@ -3,7 +3,7 @@ export {
HelloResponseAction,
type HelloPayload,
type HelloResponsePayload,
} from "./hello.js";
} from "./hello";
export {
RequestAction,
@ -25,6 +25,6 @@ export {
type DeleteAgentResult,
type UpdateGatewayParams,
type UpdateGatewayResult,
} from "./rpc.js";
} from "./rpc";
export { StreamAction, type StreamPayload } from "./stream.js";
export { StreamAction, type StreamPayload } from "./stream";

View file

@ -11,15 +11,15 @@ import type {
DeviceType,
DeviceInfo,
ListDevicesResponse,
} from "./types.js";
import { GatewayEvents } from "./types.js";
} from "./types";
import { GatewayEvents } from "./types";
import {
RequestAction,
ResponseAction,
type RequestPayload,
type ResponsePayload,
isResponseSuccess,
} from "./actions/rpc.js";
} from "./actions/rpc";
interface PendingRequest<T = unknown> {
resolve: (value: T) => void;

View file

@ -1,4 +1,4 @@
export { GatewayClient } from "./client.js";
export { GatewayClient } from "./client";
export {
GatewayEvents,
type DeviceType,
@ -12,7 +12,7 @@ export {
type PingPayload,
type PongResponse,
type ListDevicesResponse,
} from "./types.js";
} from "./types";
// Actions
export * from "./actions/index.js";
export * from "./actions/index";

View file

@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"module": "ESNext",
"moduleResolution": "bundler",
"declaration": true,
"declarationMap": true,
"sourceMap": true,