Move `packages/core/src/bridge/proto/proton/*.ts` (13 files, ~3.3k LOC) into a new `@snowluma/proto-defs` workspace package. The proton spike landed in the previous commit means bare-specifier imports (`@snowluma/proto-defs/oidb`, `…/message`, …) now resolve correctly through proton's vite plugin, so call-site replacement still fires. Why --- - Lets downstream consumers share the same wire definitions without copy-pasting them — multiple workspace packages can now depend on `@snowluma/proto-defs` directly. - Trims `@snowluma/core`'s surface: the bridge no longer owns the protocol schema, only its consumers. - Sets up future #5 (`message-parsing perf`) and #6 (`Api-on-ctx refactor`) — both want a thinner core. Layout ------ Per-file subpath exports (mirrors the legacy `proto/proton/<sub>` shape 1:1). The barrel `index.ts` intentionally skips `highway` and `oidb-actions/media` because the two files share six NTV2-prefixed type names — `export *` would silently drop one side. Subpath imports are unambiguous, which is also why every call site in core uses them. Changes ------- - New package `packages/proto-defs/` (package.json, tsconfig.json, src/index.ts). - 13 `.ts` files moved via `git mv` to preserve history. - 44 import sites across 26 source files + 15 tests rewritten via sed from `./[…/]proto/proton/<sub>` → `@snowluma/proto-defs/<sub>`. - `@snowluma/core` depends on `@snowluma/proto-defs` (workspace:*). Verification ------------ - proto-defs typecheck: clean - core typecheck: clean - core test suite: 587 passed (same baseline as before the refactor; one failure is the pre-existing websocket native addon, unrelated) - proton test suite: 99 passed (8 files including the new cross-package.test.ts from the spike) - Full workspace `pnpm -r typecheck`: all 8 projects clean Note: proton's `dist/index.js` MUST be rebuilt for the vite plugin to pick up the bare-specifier resolution. The previous commit's source change is only effective after `pnpm -F @snowluma/proton build`.
35 lines
1.7 KiB
TypeScript
35 lines
1.7 KiB
TypeScript
// SnowLuma wire-protobuf type definitions.
|
|
//
|
|
// This barrel exists so `@snowluma/proto-defs` can be resolved by a
|
|
// plain `import {} from '@snowluma/proto-defs'` (consumers that don't
|
|
// know which sub-namespace they want, or just want to see what's
|
|
// available). The package itself is otherwise consumed via the
|
|
// per-file subpath exports declared in package.json — that's the
|
|
// recommended import shape because it mirrors the legacy
|
|
// `bridge/proto/proton/<sub>` paths 1:1 and avoids name collisions.
|
|
//
|
|
// ─── Collision note ───
|
|
//
|
|
// `highway.ts` and `oidb-actions/media.ts` each define their own
|
|
// `NTV2*` types (NTV2CommonHead, NTV2ClientMeta, NTV2C2CUserInfo,
|
|
// NTV2FileInfo, NTV2FileType, NTV2GroupInfo). The two definitions
|
|
// are NOT compatible — they describe different wire shapes for
|
|
// different protocol surfaces and happen to share the same name in
|
|
// the upstream Lagrange schema. `export *` silently drops one side
|
|
// when names collide, so a consumer that grabs an `NTV2CommonHead`
|
|
// off the barrel might end up with the wrong one. Prefer the subpath
|
|
// imports below for any NTV2-named type.
|
|
|
|
export type * from './action.js';
|
|
export type * from './element.js';
|
|
// NOTE: `highway.ts` intentionally NOT re-exported here — see note above.
|
|
export type * from './longmsg.js';
|
|
export type * from './message.js';
|
|
export type * from './notify.js';
|
|
export type * from './oidb.js';
|
|
export type * from './oidb-action.js';
|
|
export type * from './oidb-actions/base.js';
|
|
export type * from './oidb-actions/group-album.js';
|
|
export type * from './oidb-actions/group-file.js';
|
|
// NOTE: `oidb-actions/media.ts` intentionally NOT re-exported — see note above.
|