Skip to content

Commit b83c747

Browse files
committed
Merge branch 'main' into feat/pre-call-testing-web
# Conflicts: # sample-apps/react/react-dogfood/style/index.scss
2 parents a7bc566 + d399bac commit b83c747

187 files changed

Lines changed: 13675 additions & 1403 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-react-sample-apps.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ jobs:
5858
project-id: prj_uNJTw7DefSAntAoWCXwJaHc1khoA
5959
- name: audio-rooms
6060
project-id: prj_0WnHcvVkXpM4PRc2ymVmrAHFILoT
61+
- name: e2ee-demo - https://stream-e2ee-demo.vercel.app
62+
project-id: prj_fdQ1cP6fTIyXkjmoKfLhNnzANF4M
6163
- name: react-dogfood - https://pronto.getstream.io
6264
project-id: prj_4TTdjeVHEDhWWiFRfjIr1QFb5ell
6365
- name: react-dogfood-staging - https://pronto-staging.getstream.io

packages/client/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export * from './src/stats/types';
1111

1212
export * from './src/Call';
1313
export * from './src/CallType';
14+
export * from './src/rtc/mediaEngine';
1415
export * from './src/StreamVideoClient';
1516
export * from './src/StreamSfuClient';
1617
export * from './src/devices';
@@ -25,6 +26,8 @@ export * from './src/helpers/sound-detector';
2526
export * from './src/helpers/loopback';
2627
export * from './src/helpers/MediaStreamRecorder';
2728
export * from './src/helpers/participantUtils';
29+
export * from './src/rtc/e2ee/E2EEManager';
30+
export * from './src/rtc/e2ee/EncryptionManager';
2831
export * as Browsers from './src/helpers/browsers';
2932

3033
export * from './src/logger';
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { rollup, type Plugin } from 'rollup';
2+
import typescript from '@rollup/plugin-typescript';
3+
import { format, resolveConfig } from 'prettier';
4+
import { dirname, resolve } from 'path';
5+
6+
interface InlineWorkerOptions {
7+
/** File names (not paths) that trigger the plugin, e.g. `['worker.ts']`. */
8+
include: string[];
9+
}
10+
11+
/**
12+
* Rollup plugin that bundles worker TypeScript files into inline functions.
13+
*
14+
* Only files whose path ends with one of the provided `include` patterns
15+
* are processed — all other modules are skipped with zero overhead.
16+
*
17+
* For each matched file, the plugin:
18+
* 1. Finds the corresponding `-impl.ts` entry (e.g. `worker.ts` → `worker/worker-impl.ts`)
19+
* 2. Bundles it with a nested Rollup + TypeScript build
20+
* 3. Wraps the result in an exported function and formats with prettier
21+
*
22+
* The consumer creates a Worker from the function via:
23+
* `new Worker(\`data:text/javascript,(\${fn.toString()})()\`)`
24+
* or via a Blob URL.
25+
*/
26+
export default function inlineWorker({ include }: InlineWorkerOptions): Plugin {
27+
const fileNames = new Set(include);
28+
29+
return {
30+
name: 'inline-worker',
31+
32+
async load(id: string) {
33+
const fileName = id.split('/').pop();
34+
if (!fileNames.has(fileName!)) return null;
35+
36+
// e2ee-worker.ts → e2ee-worker/e2ee-worker-impl.ts
37+
const dir = dirname(id);
38+
const name = fileName!.replace(/\.ts$/, '');
39+
const implPath = resolve(dir, name, `${name}-impl.ts`);
40+
41+
const bundle = await rollup({
42+
input: implPath,
43+
plugins: [
44+
typescript({
45+
tsconfig: resolve(dir, name, 'tsconfig.json'),
46+
exclude: ['**/node_modules/**', '**/__tests__/**'],
47+
}),
48+
],
49+
});
50+
51+
const { output } = await bundle.generate({
52+
format: 'es',
53+
indent: false,
54+
sourcemap: false,
55+
});
56+
await bundle.close();
57+
58+
// Wrap bundled code in an exported function, then format with prettier.
59+
return await format(
60+
`export function e2eeWorker() { ${output[0].code} }`,
61+
{
62+
parser: 'babel',
63+
...(await resolveConfig(implPath)),
64+
},
65+
);
66+
},
67+
};
68+
}

packages/client/rollup.config.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import typescript from '@rollup/plugin-typescript';
22
import replace from '@rollup/plugin-replace';
3+
import inlineWorker from './plugins/rollup-plugin-inline-worker.mts';
34

45
import pkg from './package.json' with { type: 'json' };
56

@@ -30,12 +31,15 @@ const external = [
3031
const browserConfig = {
3132
input: 'index.ts',
3233
output: {
33-
file: 'dist/index.browser.es.js',
34+
dir: 'dist',
3435
format: 'esm',
3536
sourcemap: true,
37+
entryFileNames: 'index.browser.es.js',
38+
chunkFileNames: '[name].browser.es.js',
3639
},
3740
external: external.filter((dep) => !browserIgnoredModules.includes(dep)),
3841
plugins: [
42+
inlineWorker({ include: ['e2ee-worker.ts'] }),
3943
replace({
4044
preventAssignment: true,
4145
'process.env.PKG_VERSION': JSON.stringify(pkg.version),
@@ -55,6 +59,7 @@ const createNodeConfig = (outputFile, format) => ({
5559
file: outputFile,
5660
format: format,
5761
sourcemap: true,
62+
inlineDynamicImports: true,
5863
},
5964
external,
6065
plugins: [

0 commit comments

Comments
 (0)