Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions rivetkit-typescript/packages/traces/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@
],
"exports": {
".": {
"browser": {
"import": {
"types": "./dist/tsup/browser.d.ts",
"default": "./dist/tsup/browser.js"
},
"require": {
"types": "./dist/tsup/browser.d.cts",
"default": "./dist/tsup/browser.cjs"
}
},
"import": {
"types": "./dist/tsup/index.d.ts",
"default": "./dist/tsup/index.js"
Expand All @@ -36,15 +46,15 @@
"node": ">=18.0.0"
},
"scripts": {
"build": "pnpm run compile:bare && tsup src/index.ts src/reader.ts",
"build": "pnpm run compile:bare && tsup src/index.ts src/reader.ts src/browser.ts",
"compile:bare": "tsx scripts/compile-bare.ts compile schemas/v1.bare -o dist/schemas/v1.ts",
"check-types": "pnpm run compile:bare && tsc --noEmit",
"test": "pnpm run compile:bare && vitest run"
},
"dependencies": {
"@rivetkit/bare-ts": "^0.6.2",
"cbor-x": "^1.6.0",
"fdb-tuple": "^1.0.0",
"@rivetkit/fdb-tuple": "https://pkg.pr.new/rivet-dev/fdb-tuple/@rivetkit/fdb-tuple@32f95e2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The custom URL dependency '@rivetkit/fdb-tuple': 'https://pkg.pr.new/rivet-dev/fdb-tuple/@rivetkit/fdb-tuple@32f95e2' is causing TypeScript compilation errors during CI. Consider using a standard npm package, a GitHub URL (github:rivet-dev/fdb-tuple#commit-hash), or adding a resolution in the root package.json to help resolve this URL correctly.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

"vbare": "^0.0.4"
},
"devDependencies": {
Expand Down
84 changes: 84 additions & 0 deletions rivetkit-typescript/packages/traces/src/browser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Browser stub for @rivetkit/traces
// This file is used as the browser entry point to prevent Node.js-specific code from being bundled

import type {
OtlpAnyValue,
OtlpExportTraceServiceRequestJson,
OtlpInstrumentationScope,
OtlpKeyValue,
OtlpResource,
OtlpResourceSpans,
OtlpScopeSpans,
OtlpSpan,
OtlpSpanEvent,
OtlpSpanLink,
OtlpSpanStatus,
} from "./otlp.js";
import type {
EndSpanOptions,
EventOptions,
ReadRangeOptions,
ReadRangeResult,
ReadRangeWire,
SpanHandle,
SpanStatusInput,
StartSpanOptions,
Traces,
TracesDriver,
TracesOptions,
UpdateSpanOptions,
} from "./types.js";

function notSupported(name: string): never {
throw new Error(
`@rivetkit/traces: ${name} is not supported in the browser. Traces are only available on the server.`,
);
}

export function createTraces(
_options: TracesOptions<OtlpResource>,
): Traces<OtlpExportTraceServiceRequestJson> {
notSupported("createTraces");
}

export function encodeReadRangeWire(_wire: ReadRangeWire): Uint8Array {
notSupported("encodeReadRangeWire");
}

export function decodeReadRangeWire(_bytes: Uint8Array): ReadRangeWire {
notSupported("decodeReadRangeWire");
}

export function readRangeWireToOtlp(
_wire: ReadRangeWire,
_resource?: OtlpResource,
): { otlp: OtlpExportTraceServiceRequestJson; clamped: boolean } {
notSupported("readRangeWireToOtlp");
}

// Re-export types (these are safe for browsers)
export type {
EndSpanOptions,
EventOptions,
ReadRangeOptions,
ReadRangeResult,
ReadRangeWire,
SpanHandle,
SpanStatusInput,
StartSpanOptions,
Traces,
TracesDriver,
TracesOptions,
UpdateSpanOptions,
OtlpAnyValue,
OtlpExportTraceServiceRequestJson,
OtlpInstrumentationScope,
OtlpKeyValue,
OtlpResource,
OtlpResourceSpans,
OtlpScopeSpans,
OtlpSpan,
OtlpSpanEvent,
OtlpSpanLink,
OtlpSpanStatus,
};
Comment on lines +1 to +84
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new file likely has formatting issues throughout. Since it's a completely new file, it should be formatted according to Biome's rules. Run 'biome format --write' on this file to ensure proper formatting.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Loading
Loading