Skip to content

fix: verify native prebuild fixtures - #426

Open
wanxiankai wants to merge 2 commits into
callstackincubator:nextfrom
wanxiankai:fix/verify-prebuild-fixtures
Open

fix: verify native prebuild fixtures#426
wanxiankai wants to merge 2 commits into
callstackincubator:nextfrom
wanxiankai:fix/verify-prebuild-fixtures

Conversation

@wanxiankai

Copy link
Copy Markdown

Summary

  • parse each Apple framework Info.plist and verify its executable and bundle identifier
  • add the competing .node fixture to the Babel plugin test
  • preserve Node.js module resolution precedence when JavaScript and native addon files share a basename

Test plan

  • pnpm run build
  • pnpm --filter react-native-node-api test (61 tests passed)
  • pnpm exec eslint packages/host/src/node/babel-plugin/plugin.ts packages/host/src/node/babel-plugin/plugin.test.ts packages/node-addon-examples/scripts/verify-prebuilds.mts
  • pnpm run prettier:check

Closes #424

Comment thread packages/node-addon-examples/scripts/verify-prebuilds.mts Outdated
@kraenhansen

Copy link
Copy Markdown
Collaborator

Sorry, this needs a rebase now 🙈

@kraenhansen kraenhansen self-assigned this Aug 13, 2026
@wanxiankai
wanxiankai force-pushed the fix/verify-prebuild-fixtures branch from 33ca234 to 2d4f74f Compare August 13, 2026 13:22
@wanxiankai

Copy link
Copy Markdown
Author

Rebased onto the latest next and force-pushed as 2d4f74f. I also switched the plist parser to the package-level @expo/plist export. The branch is now conflict-free.

Re-ran:

  • pnpm run build
  • pnpm --filter react-native-node-api test (61/61 passed)
  • targeted ESLint
  • pnpm run prettier:check

Everything passes locally. The GitHub Actions workflow is currently awaiting maintainer approval.

kraenhansen commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

I pushed a few follow-up refinements (moving the .js/.node precedence check into the shared isNodeApiModule utility instead of the Babel plugin's require.resolve() guard, zod-validating the parsed Info.plist, and reusing escapeBundleIdentifier instead of re-deriving the escaping regex). Thanks for finding and fixing the real bug here, @wanxiankai!


Partially generated by Claude Code

wanxiankai and others added 2 commits August 16, 2026 20:10
- Replace the Babel-transform-time require.resolve() guard with a check
  inside isNodeApiModule itself, so the fix lives in the shared utility
  (also used by findNodeAddonForBindings) instead of duplicating Node's
  module resolution algorithm via a second, independent code path that
  could diverge from what Metro actually resolves at runtime.
- Verify the Info.plist contents with a zod schema instead of ad hoc
  "in" checks on an untyped object, matching how the rest of the repo
  validates untrusted structured data.
- Reuse the exported escapeBundleIdentifier instead of re-deriving the
  bundle-identifier escaping regex inline in the verify script, so the
  two can't silently drift apart.

Closes callstackincubator#424

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q1k6UQJPPaqKEKmnsRUatt
@kraenhansen
kraenhansen force-pushed the fix/verify-prebuild-fixtures branch from a848741 to 7e212f5 Compare August 16, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Two test gaps: unverified prebuild Info.plist and a missing .node fixture in the Babel plugin tests

3 participants