Initial commit: Text encoding component with UTF-8 polyfills
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
46
index.ts
Normal file
46
index.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
Reference in New Issue
Block a user