Repository navigation
Verify React Native compatibility - #56
Merged
willwade merged 8 commits intoOct 13, 2026
Merged
Conversation
The Gridset/Snap/TouchChat validators used xml2js, which requires the Node core modules events and timers (and its sax dependency requires stream). Metro cannot resolve those in React Native/Expo, so the browser distribution could not be bundled and needed Vite polyfills/aliases for web. Add a shared src/utils/xml.ts wrapper around fast-xml-parser (already a dependency and Node-free) configured to keep the xml2js output shape: attributes grouped under $, every non-root element always an array, and string values. Well-formedness is checked with XMLValidator first because fast-xml-parser is permissive. Update the three validators and drop xml2js, its @types (which was wrongly listed as a runtime dependency), and the transitive sax/xmlbuilder packages. All 847 tests pass.
Add scripts/verify-rn-bundle.js and an isolated Metro fixture (test/rn-metro-check, babel-preset-expo) that bundles a copy of dist/browser with the actual React Native bundler. Running the real resolver catches Node core modules reached transitively through dependencies, which scanning our own compiled files cannot see. This probe originally failed on the xml2js dependency chain (xml2js -> events/timers, sax -> stream). With the validators now on fast-xml-parser the browser build bundles cleanly, so xml2js is not needed in the fixture. Metro lives only in the fixture, not in the library's runtime deps. Run with npm run verify:rn-bundle.
Replace the React Native-only section in scripts/README.md with a Browser verification section covering verify-browser-build.js, verify-rn-bundle.js and smoke-browser-bundle.js.
Add an rn-bundle job that installs the Metro fixture and runs npm run verify:rn-bundle, so a browser build that Metro/Hermes cannot bundle (for example a dependency that pulls in Node core modules) fails CI. Pinned to Node 22 because Metro 0.87 requires >= 22.13, while the test matrix also runs Node 20.
Fold the Metro guard into the existing test job on the Node 22 leg instead of a separate job, reusing the root install and the dist/browser that test:ci already builds. Metro 0.87 requires Node >= 22.13, so the steps are skipped on the Node 20 leg.
Collaborator
|
Merged — a real Metro probe in CI is exactly the right guard, and catching transitive Node-core imports is the part a dist scan can't do. Nice. |
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.
This update is built upon #55. It checks for React Native compatibility by attempting to bundle the browser distribution with Metro. The check is included in the CI workflow to avoid incompatible builds.