Repository navigation
fix(linkifyjs): build Unicode regexes dynamically for ICU-free runtimes - #572
Open
aleclarson wants to merge 1 commit into
Open
aleclarson wants to merge 1 commit into
aleclarson wants to merge 1 commit into
Conversation
LETTER and EMOJI were declared as /\p{L}/u and /\p{Emoji}/u literals at
module scope. Embedded JS runtimes built without ICU (e.g. NativeScript's
V8) throw a SyntaxError at parse time for \p{} property escapes — before
any try/catch in user code can run — so importing the package poisons the
whole bundle.
Build the regexes via new RegExp inside try/catch with ASCII-range
fallbacks: identical behavior where ICU exists, graceful degradation
where it doesn't.
aleclarson
added a commit
to octane-xplat/octane-xplat
that referenced
this pull request
Oct 8, 2026
Filed upstream PRs for the five patch-audit fixes and recorded them via a new upstreamPR field on the manifest entries: - nativescript-community/octane#14 — setProp undefined-skip, visibility capability, intrinsic ref types - nativescript-community/octane#15 — vite-octane .tsrx HMR matching and recipients counting - nativescript-community/ui-image#69 — iOS prefetch cacheType + headers - nfrasser/linkifyjs#572 — ICU-free \p{} regex construction - facebook/lexical#9334 — @lexical/link URL_REGEX via new RegExp - NativeScript/NativeScript#11514 — font-weight → wght axis mapping on Android (issue #11513)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
packages/linkifyjs/src/regexp.mjsdeclaresLETTERandEMOJIas/\p{L}/uand/\p{Emoji}/uregex literals at module scope. Embedded JS runtimes built without ICU — e.g. NativeScript's V8 — throw aSyntaxErrorat parse time for\p{}property escapes. The whole file fails to parse, so any bundled app importinglinkifyjs(or a transitive importer like@tiptap/extension-link) dies on boot; no user-level try/catch can intercept a parse error.Repro
Bundle
linkifyjsfor a NativeScript app (or evaluate the module in a V8 build with--no-icu/ no ICU data):Fix
Declare
LETTER/EMOJIasletwith ASCII-range fallbacks, then upgrade them vianew RegExp('\\p{L}', 'u')/new RegExp('\\p{Emoji}', 'u')inside try/catch. Where ICU exists the behavior is identical; where it doesn't, matching degrades to ASCII letters and the common emoji ranges instead of crashing the bundle.