Commit a94d74c
feat(spm): treat package.json codegenConfig as an implicit React-core dep
New-Architecture libraries (react-native-svg, …) declare their React-core
dependency only through the `install_modules_dependencies(s)` podspec helper —
which auto-adds React-Core / React-RCTFabric / React-Codegen at install time —
rather than an explicit `s.dependency "React-Core"`. We strip that helper when
evaluating the podspec, so the React-core dependency never surfaced in
model.dependencies and `coreReactNative` stayed false. The scaffolded manifest
then declared no dependencies at all, and the lib's Fabric sources failed with:
RNSVGShadowNodes.cpp:1:10: fatal error:
'react/renderer/components/rnsvg/ShadowNodes.h' file not found
That generated header lives in the per-app React-GeneratedCode package (the
`ReactAppHeaders` target vends `react/renderer/components/<name>/…`), which the
lib can only reach via an SPM dependency — SwiftPM forbids a headerSearchPath
from escaping the package root, so cross-package headers must come through a
dependency's publicHeadersPath.
Fix: detect a `codegenConfig` block in the dep's package.json — RN's
authoritative marker that a library participates in the New Architecture /
codegen — and treat it as an implicit React-core dependency. That makes the
scaffolder emit the existing `.package(name: "React-GeneratedCode", …)` +
`.product(name: "ReactAppHeaders", …)` wiring, so the generated component
headers resolve.
Verified: react-native-svg now BUILD SUCCEEDED via the scaffolder on a real
RN 0.87 app (previously stopped at the ShadowNodes.h codegen header).
SCAFFOLDER_VERSION bumped to 17. 401 spm tests green (2 new).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent d2c6e2e commit a94d74c
2 files changed
Lines changed: 75 additions & 1 deletion
File tree
- packages/react-native/scripts/spm
- __tests__
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
324 | 363 | | |
325 | 364 | | |
326 | 365 | | |
| |||
Lines changed: 36 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
150 | 168 | | |
151 | 169 | | |
152 | 170 | | |
| |||
325 | 343 | | |
326 | 344 | | |
327 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
328 | 363 | | |
329 | 364 | | |
330 | 365 | | |
| |||
0 commit comments