🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
/**
|
|
* Text Encoding Module
|
|
*
|
|
* Provides UTF-8 text encoding/decoding for React Native with automatic polyfill support.
|
|
* Compatible with the standard TextEncoder/TextDecoder Web API.
|
|
*
|
|
* @module text-encoding@1.0.0
|
|
*/
|
|
|
|
// Export factory and helpers
|
|
export {
|
|
createTextDecoder,
|
|
createTextEncoder,
|
|
installTextEncodingPolyfills,
|
|
TextEncodingFactory,
|
|
} from './TextEncodingFactory';
|
|
export { TextDecoderPolyfill } from './TextDecoderPolyfill';
|
|
|
|
// Export implementations (for advanced usage)
|
|
export { TextEncoderPolyfill } from './TextEncoderPolyfill';
|
|
export {
|
|
getTextEncodingService,
|
|
TextEncodingService,
|
|
} from './TextEncodingService';
|
|
|
|
// Create and export default service instance
|
|
import { getTextEncodingService } from './TextEncodingService';
|
|
|
|
/**
|
|
* Default shared text encoding service
|
|
* Use this for most encoding/decoding needs
|
|
*/
|
|
export const textEncoding = getTextEncodingService();
|
|
|
|
// Version information
|
|
export const VERSION = '1.0.0';
|
|
export const COMPONENT_NAME = 'text-encoding';
|
|
|
|
// Auto-install polyfills on import (for React Native)
|
|
import { installTextEncodingPolyfills } from './TextEncodingFactory';
|
|
|
|
// Only install in React Native environment
|
|
// @ts-expect-error
|
|
if (typeof global !== 'undefined' && !global.window) {
|
|
installTextEncodingPolyfills();
|
|
} |