@cloudflare/realtimekit 2.0.5-staging.2 → 2.1.0-staging.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3233,7 +3233,8 @@ declare const ERROR_CODES: {
3233
3233
  };
3234
3234
  declare class ClientError extends Error {
3235
3235
  code: keyof typeof ERROR_CODES;
3236
- constructor(message: string, code?: keyof typeof ERROR_CODES, logger?: Logger | undefined, log?: boolean);
3236
+ reason?: string;
3237
+ constructor(message: string, code?: keyof typeof ERROR_CODES, logger?: Logger | undefined, log?: boolean, reason?: string | undefined);
3237
3238
  }
3238
3239
  declare class StoreManager {
3239
3240
  stores: Map<String, Store>;
@@ -4084,7 +4084,8 @@ declare const ERROR_CODES: {
4084
4084
  };
4085
4085
  declare class ClientError extends Error {
4086
4086
  code: keyof typeof ERROR_CODES;
4087
- constructor(message: string, code?: keyof typeof ERROR_CODES, logger?: Logger | undefined, log?: boolean);
4087
+ reason?: string;
4088
+ constructor(message: string, code?: keyof typeof ERROR_CODES, logger?: Logger | undefined, log?: boolean, reason?: string | undefined);
4088
4089
  }
4089
4090
  type EventMap = {
4090
4091
  [key: string]: (...args: any[]) => void;
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@cloudflare/realtimekit",
3
- "version": "2.0.5-staging.2",
3
+ "version": "2.1.0-staging.1",
4
4
  "description": "A real-time video and audio SDK for building custom, collaborative communication experiences.",
5
+ "license": "Apache-2.0",
6
+ "files": [
7
+ "dist"
8
+ ],
5
9
  "main": "./dist/index.cjs.js",
6
10
  "module": "./dist/index.es.js",
7
11
  "exports": {
package/AGENTS.md DELETED
@@ -1,63 +0,0 @@
1
- # CORE PACKAGE KNOWLEDGE BASE
2
-
3
- ## OVERVIEW
4
- `@cloudflare/realtimekit` — the WebRTC SDK engine; single default export `RealtimeKitClient`.
5
-
6
- ## STRUCTURE
7
- ```
8
- core/
9
- ├── .config/ # 6 Vite build configs + build-types.sh + prepublish.js
10
- ├── src/ # All source (controllers, media, roomNode, socketService, e2ee, mock, …)
11
- ├── docs/ # Node-based API reference generator (jsdoc-to-markdown)
12
- ├── samples/ # Standalone transformer examples (audio/video middleware demos)
13
- ├── __mocks__/ # Vitest manual mocks: window globals + sockrates-client
14
- └── dist/ # Build output (not committed; generated by build scripts)
15
- ```
16
-
17
- ## BUILD TARGETS
18
-
19
- | Vite config | Output file(s) | Format | Purpose |
20
- |-------------|---------------|--------|---------|
21
- | `vite.config.ts` | `dist/index.es.js`, `dist/index.cjs.js` | ESM + CJS | Main tree-shakeable + CommonJS builds |
22
- | `vite.iife.config.ts` | `dist/browser.js` | IIFE | Self-contained browser bundle; bundle diff tracked in CI |
23
- | `vite.rn.config.ts` | `dist/index.rn.js` | CJS | React Native / Metro-compatible build |
24
- | `vite.es5.config.ts` | `dist/index.es5.js` | ESM+Babel | Babel-transpiled ES5-compatible output via `@babel/preset-env` |
25
- | `vite.e2ee.es.ts` | `dist/EncryptionManager.{es,cjs}.js` | ESM + CJS | E2EE sub-module (`./e2ee` export path) |
26
- | `vite.mock.es.ts` | `dist/ClientMock.{es,cjs}.js` | ESM + CJS | Mock client for testing (`./mock` export path); polyfills `events`+`buffer` |
27
- | `build-types.sh` (tsup) | `dist/index.d.ts`, `dist/EncryptionManager.d.ts`, `dist/ClientMock.d.ts` | `.d.ts` | Type declarations via tsup `--dts-only`; strips `#private;` lines |
28
-
29
- **Build order inside `core`:** All 6 Vite targets run in parallel via `concurrently`, then `build:types` runs, then `downlevel-dts`.
30
-
31
- ## EXPORT PATHS
32
-
33
- | Export path | File | Consumers |
34
- |-------------|------|-----------|
35
- | `.` | `dist/index.es.js` / `dist/index.cjs.js` | Standard ESM/CJS imports |
36
- | `./inlined` | `dist/browser.js` | Script-tag / CDN — all deps bundled in |
37
- | `./compatible` | `dist/index.es5.js` | Legacy bundlers requiring ES5 |
38
- | `./e2ee` | `dist/EncryptionManager.{es,cjs}.js` | Apps opting into E2EE encryption |
39
- | `./mock` | `dist/ClientMock.{es,cjs}.js` | Test environments (no real WebRTC) |
40
-
41
- TypeScript `<4.0` consumers are redirected to `dist/ts3.4/` via `typesVersions`.
42
-
43
- ## WHERE TO LOOK
44
-
45
- | Task | Location |
46
- |------|----------|
47
- | Type declaration generation | `.config/build-types.sh` — temporarily removes `@cloudflare/realtimekit-proto-entities` before tsup so its types are bundled, then strips `#private;` lines from `.d.ts` |
48
- | Pre-publish package.json rewrite | `.config/prepublish.js` — removes private deps, injects `VERSION_PLACEHOLDER` into 4 dist files, sets npm tag from `ENVIRONMENT` env var |
49
- | Post-publish restore | `package.json` backed up to `package.json.bak` before publish; restored via `postpublish` script |
50
- | TS 3.4 compat types | `dist/ts3.4/` produced by `downlevel-dts dist dist/ts3.4/dist` after type build |
51
- | Bundle analyzer | `stats.html` generated by `rollup-plugin-visualizer` when `VITE_ANALYZE=1` |
52
- | Transformer samples | `samples/transformers/` — audio (low-pass, pitch, noise) + video middleware examples |
53
- | API reference generator | `docs/api-reference-generator.js` — run via `npm run docs`; outputs Markdown from JSDoc |
54
-
55
- ## NOTES
56
-
57
- - `dist/browser.js` is the IIFE bundle — CI tracks its size diff on every PR; do not add large dependencies to the main entry without expecting a size alert.
58
- - `react-native` field in `package.json` (`./dist/index.rn.js`) is read by Metro bundler and points to the CJS React Native build.
59
- - `build-types.sh` temporarily removes `@cloudflare/realtimekit-proto-entities` from `package.json` so tsup bundles its types into the output `.d.ts`; `package.json` is restored via `trap restore EXIT`.
60
- - `prepublish.js` strips `lodash-es`, `axios`, and `@cloudflare/realtimekit-*` dependencies before publishing because they are inlined in the dist; matching packages and public type dependencies are retained as development-only type dependencies.
61
- - `envPrefix: 'RTK_'` — only `RTK_*` env vars are exposed to Vite builds; use `RTK_` prefix for any new build-time flags.
62
- - `vite.mock.es.ts` adds Node polyfills (`events`, `buffer`) because `ClientMock` runs in Node test environments.
63
- - `vitest-github-coverage-provider.mts` — custom coverage reporter that emits GitHub-compatible annotations; only active in CI.
File without changes