Skip to content

Commit fed9c58

Browse files
committed
readme
1 parent dc0927f commit fed9c58

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,18 @@ If you're updating your SDK version, please check the appropriate migration guid
207207

208208
## SDK Development
209209

210+
### Platform Isolation
211+
212+
The SDK supports multiple JavaScript platforms (Browser, Node.js, React Native) with a unified codebase. To prevent runtime errors from platform-specific code being bundled incorrectly, we enforce **platform isolation** constraints:
213+
214+
- Every source file must declare which platforms it supports using `export const __platforms: Platform[] = [...]`
215+
- Files can only import from other files that support all their declared platforms
216+
- Universal files (`__platforms = ['__universal__']`) work everywhere but can only import from other universal files
217+
218+
This system is enforced at build time through ESLint rules and validation scripts, ensuring platform-specific code (like browser DOM APIs or Node.js `fs` module) never leaks into incompatible builds.
219+
220+
**For detailed documentation**, see [docs/PLATFORM_ISOLATION.md](docs/PLATFORM_ISOLATION.md).
221+
210222
### Unit Tests
211223

212224
There is a mix of testing paradigms used within the JavaScript SDK which include Mocha, Chai, Karma, and Vitest, indicated by their respective `*.tests.js` and `*.spec.ts` filenames.

0 commit comments

Comments
 (0)