File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 11import * as types from './types' ;
22import { dispatchToMainThread , dispatchToUIThread , isMainThread } from './mainthread-helper' ;
3- import emojiRegex from 'emoji-regex' ;
3+ import * as emojiRegexModule from 'emoji-regex' ;
4+
5+ // Normalize emoji-regex CommonJS / ESM shapes into a callable function.
6+ // Some bundlers expose it as module.exports, others as module.exports.default.
7+ const emojiRegex : ( input : string ) => RegExp = ( ( ) => {
8+ const mod : any = emojiRegexModule ;
9+ if ( mod && typeof mod . default === 'function' ) {
10+ return mod . default ;
11+ }
12+ if ( typeof mod === 'function' ) {
13+ return mod ;
14+ }
15+ // Fallback: minimal safe regex that never throws.
16+ return ( ) => / ./ g;
17+ } ) ( ) ;
418
519export * from './mainthread-helper' ;
620export * from './macrotask-scheduler' ;
@@ -168,5 +182,5 @@ export function mainThreadify(func: Function): (...args: any[]) => void {
168182export function isEmoji ( value : string ) : boolean {
169183 // TODO: In a future runtime update, we can switch to using Unicode Property Escapes:
170184 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes
171- return emojiRegex ( ) . test ( value ) ;
185+ return emojiRegex ( value ) . test ( value ) ;
172186}
You can’t perform that action at this time.
0 commit comments