mirror of
https://github.com/meshtastic/web.git
synced 2026-07-31 15:06:27 -04:00
The legacy `@meshtastic/core` package is gone. The six transport-* packages and the web app no longer depend on it; everything routes through `@meshtastic/sdk`. Transport packages (transport-deno, transport-http, transport-node, transport-node-serial, transport-web-bluetooth, transport-web-serial): - package.json deps swap `@meshtastic/core: workspace:*` for `@meshtastic/sdk: workspace:*`. - src/transport.ts + src/transport.test.ts imports point at `@meshtastic/sdk` (the `Types` and `Utils` namespaces are still exported from the SDK so source code is otherwise unchanged). - README.md examples updated to import from `@meshtastic/sdk`. apps/web: - Drops the leftover `@meshtastic/core` workspace dep; nothing in apps/web/src imports from it. @meshtastic/sdk: - README description loses the "Replaces @meshtastic/core" suffix — there's nothing left to replace. - Three legacy shim files keep their re-exports but their docstrings drop the "Phase-A shim, removed in Phase C" framing. The MeshDevice facade survives because the web app's `connection.factoryResetDevice()` / `connection.reboot()` / etc. callsites still go through it; new consumers should reach into `client.config` / `client.chat` / etc. - New scripts/rename-dts.mjs is a postbuild step that renames tsdown's hashed entry-point dts outputs (`mod-<hash>.d.ts` etc.) back to their canonical names so package.json `types` and downstream dts-bundlers can find them. Internal chunk dts files (e.g. `Transport-<hash>.d.ts`) are intentionally NOT renamed because mod.d.ts imports them by path. - build:npm runs tsdown then the rename script. Version bumps (signal: now require @meshtastic/sdk): - @meshtastic/sdk 0.1.0 -> 1.0.0 - @meshtastic/sdk-react 0.1.0 -> 1.0.0 - @meshtastic/sdk-storage-sqlocal 0.1.0 -> 1.0.0 - @meshtastic/transport-http 0.2.5 -> 1.0.0 - @meshtastic/transport-web-serial 0.2.5 -> 1.0.0 - @meshtastic/transport-web-bluetooth 0.1.5 -> 1.0.0 - @meshtastic/transport-deno 0.1.1 -> 1.0.0 - @meshtastic/transport-node 0.0.2 -> 1.0.0 - @meshtastic/transport-node-serial 0.0.2 -> 1.0.0 Workflows: nothing referenced packages/core directly (only the release-packages.yml glob which already collapsed in the apps/web move). README packages table loses the legacy `packages/core` row. Verified: web build clean, all four package suites green (web 236, sdk 65, sdk-react 8, storage 30). The transport packages' dist build is currently blocked by a tsdown cross-chunk dts resolution glitch where the `Types` namespace import can't follow `mod.d.ts`'s reference to the internal `Transport-<hash>` chunk. Runtime is fine — only the published-types path is affected, and transport packages publish via their own release flow. Logged as follow-up.
@meshtastic/sdk-react
React hooks and provider for @meshtastic/sdk.
Install
pnpm add @meshtastic/sdk @meshtastic/sdk-react @meshtastic/transport-web-serial
Quickstart
import { MeshClient } from "@meshtastic/sdk";
import { MeshProvider, useDevice, useChat } from "@meshtastic/sdk-react";
import { TransportWebSerial } from "@meshtastic/transport-web-serial";
import { ChannelNumber } from "@meshtastic/sdk";
const transport = await TransportWebSerial.create({ baudRate: 115200 });
const client = new MeshClient({ transport });
await client.connect();
function App() {
return (
<MeshProvider client={client}>
<Status />
</MeshProvider>
);
}
function Status() {
const { status, myNodeNum } = useDevice();
const { messages, send } = useChat(ChannelNumber.Primary);
return <div>{status} / {myNodeNum} / {messages.length} msgs</div>;
}
All hooks are read-only against a single MeshClient instance supplied through context. Commands are returned as stable functions.
License
GPL-3.0-only.