Skip to content

Conversation

@raju-opti
Copy link
Contributor

@raju-opti raju-opti commented Nov 24, 2025

Summary

This PR implements a comprehensive platform isolation system for a multi-platform JavaScript SDK that supports Browser, Node.js, and React Native. The system enforces that platform-specific code cannot be imported by incompatible platforms, preventing runtime errors when bundling for different targets.

Key changes:

  • Adds validation scripts that check __platforms exports and import compatibility
  • Adds script to automatically add __platforms exports based on file name
  • Integrates ESLint rule to enforce platform declarations at development time
  • Adds extensive documentation and troubleshooting guides
  • Updates all source files to include __platforms exports

Test plan

  • extensive manual testing

Issues

  • FSSDK-12092

@coveralls
Copy link

coveralls commented Nov 26, 2025

Coverage Status

coverage: 77.752% (-0.6%) from 78.387%
when pulling c7be4d4 on raju/platform_validator
into 860fca0 on master.

@raju-opti raju-opti changed the title Platform validaor [FSSDK-12092] add platform verification for imports Nov 28, 2025
Copilot finished reviewing on behalf of raju-opti November 28, 2025 19:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a comprehensive platform isolation system for a multi-platform JavaScript SDK that supports Browser, Node.js, and React Native. The system enforces that platform-specific code cannot be imported by incompatible platforms, preventing runtime errors when bundling for different targets.

Key changes:

  • Adds validation scripts that check __platforms exports and import compatibility
  • Integrates ESLint rule to enforce platform declarations at development time
  • Adds extensive documentation and troubleshooting guides
  • Updates all source files to include __platforms exports

Reviewed changes

Copilot reviewed 141 out of 142 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
scripts/validate-platform-isolation.js Main validation script that enforces platform isolation rules
scripts/platform-utils.js Shared utilities for platform extraction and validation
scripts/test-validator.js Test suite for platform compatibility rules
scripts/add-platform-exports.js Auto-fix script to add missing __platforms exports
.platform-isolation.config.js Configuration for include/exclude patterns
eslint-local-rules/require-platform-declaration.js ESLint rule enforcing __platforms exports
lib/platform_support.ts Type definition for valid platforms
vitest.config.mts Adds coverage configuration
docs/PLATFORM_ISOLATION.md Comprehensive platform isolation documentation
package.json Adds validation scripts and new dependencies
lib/**/*.ts Adds __platforms exports to all source files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants