expo 58.0.1 → 58.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/android/build.gradle +2 -2
  2. package/build/winter/runtime.native.js +0 -2
  3. package/build/winter/runtime.native.js.map +1 -1
  4. package/bundledNativeModules.json +77 -77
  5. package/ios/Expo/ExpoReactNativeFactory.swift +2 -2
  6. package/ios/ExpoObjC/AppDelegates/EXReactRootViewFactory.mm +16 -2
  7. package/ios/ExpoObjC/include/Expo/EXReactRootViewFactory.h +2 -1
  8. package/package.json +17 -18
  9. package/scripts/spm/__tests__/app-target.test.js +105 -1
  10. package/scripts/spm/__tests__/autolink-gate.test.js +188 -0
  11. package/scripts/spm/__tests__/classify.test.js +17 -19
  12. package/scripts/spm/__tests__/diagnostics.test.js +705 -132
  13. package/scripts/spm/__tests__/manifests.test.js +1086 -75
  14. package/scripts/spm/__tests__/metadata.test.js +120 -0
  15. package/scripts/spm/__tests__/plugin.test.js +2549 -346
  16. package/scripts/spm/app-target.js +44 -1
  17. package/scripts/spm/autolink-gate.js +40 -0
  18. package/scripts/spm/classify.js +54 -77
  19. package/scripts/spm/diagnostics.js +540 -147
  20. package/scripts/spm/flavored-frameworks.js +80 -125
  21. package/scripts/spm/manifests.js +523 -205
  22. package/scripts/spm/metadata.js +152 -0
  23. package/scripts/spm/plugin.js +592 -277
  24. package/scripts/spm/podspec.js +56 -19
  25. package/src/async-require/__tests__/loadBundle.test.ios.ts +2 -2
  26. package/src/winter/__tests__/{TextDecoderStream.test.ios.ts → TextDecoderStream.test.native.ts} +23 -2
  27. package/src/winter/runtime.native.ts +0 -2
  28. package/template.tgz +0 -0
  29. package/build/winter/TextDecoder.d.ts +0 -13
  30. package/build/winter/TextDecoder.js +0 -357
  31. package/build/winter/TextDecoder.js.map +0 -1
  32. package/src/winter/TextDecoder.ts +0 -427
  33. package/src/winter/__tests__/TextDecoder.test.native.ts +0 -549
@@ -25,10 +25,11 @@
25
25
  * NOTE: RN invokes the plugin SYNCHRONOUSLY (`plugin(context)`, no await), so
26
26
  * everything shells out via `execFileSync` (see cli.js) rather than awaiting.
27
27
  *
28
- * The logic is split across sibling modules — cli.js (I/O), classify.js
29
- * (discovery), app-target.js (the app's Xcode target), flavored-frameworks.js
30
- * (precompiled frameworks), react-descriptor.js + manifests.js (rendering),
31
- * podspec.js (podspec reading),
28
+ * The logic is split across sibling modules — cli.js (I/O), metadata.js (the
29
+ * prebuilt-metadata document), classify.js (discovery), app-target.js (the app's
30
+ * Xcode target), flavored-frameworks.js (precompiled frameworks),
31
+ * react-descriptor.js + manifests.js (rendering),
32
+ * podspec.js (podspec reading), autolink-gate.js (`autolinkWhen` gates),
32
33
  * script-phases.js (build script phases), diagnostics.js (errors and
33
34
  * warnings) — with unit tests in __tests__/. This file is just the orchestrator.
34
35
  */
@@ -38,48 +39,51 @@
38
39
  const fs = require('fs');
39
40
  const path = require('path');
40
41
 
41
- const { resolveAppTarget } = require('./app-target');
42
- const { resolveExpoModules, prebuiltMetadata, generateModulesProvider } = require('./cli');
42
+ const { readPodfileProperties, resolveAppTarget } = require('./app-target');
43
+ const {
44
+ autolinkConditionKey,
45
+ autolinkConditionLabel,
46
+ autolinkConditionMet,
47
+ } = require('./autolink-gate');
48
+ const { resolveExpoModules, generateModulesProvider } = require('./cli');
43
49
  const {
44
- APPLE_SOURCE_DIRS,
45
- appleSourceDir,
46
50
  collectWatchPaths,
47
51
  documentedPackageRoot,
48
52
  findModuleRoot,
49
53
  moduleNeedsReact,
50
- isPureSwift,
54
+ scanAppleSources,
51
55
  } = require('./classify');
52
56
  const {
53
57
  classifyUnsupported,
58
+ collectDuplicatePods,
54
59
  collectRootConflicts,
55
- collectUnmappedDependencies,
60
+ pluginError,
61
+ realPathOrSelf,
56
62
  renderExtraPodsWarning,
63
+ renderLeftOutCompanionWarning,
64
+ renderPartlyProvidedPackageWarning,
57
65
  renderRootConflictWarning,
58
66
  renderUnmappedDependencyWarning,
59
67
  renderXcconfigLinkerWarning,
60
68
  reportUnsupported,
69
+ unmappedPodDependencies,
61
70
  } = require('./diagnostics');
62
71
  const {
72
+ artifactBaseDirs,
63
73
  assertDistinctFlavoredFrameworks,
64
74
  byteOrder,
65
75
  prepareCompileInterfaces,
66
76
  resolveFlavoredFramework,
67
77
  resolveSpmDependencyFrameworks,
68
78
  } = require('./flavored-frameworks');
69
- const {
70
- emitSourceManifestPackage,
71
- emitPureSwiftSourcePackage,
72
- raiseFloor,
73
- } = require('./manifests');
74
- const { readPodspecs } = require('./podspec');
79
+ const { emitSourceManifestPackage, emitPureSwiftSourcePackage } = require('./manifests');
80
+ const { readPrebuiltMetadata } = require('./metadata');
81
+ const { readPodspecFacts } = require('./podspec');
75
82
  const { scriptPhasesForModules } = require('./script-phases');
76
83
 
77
- /**
78
- * The module roots React Native resolved, keyed by npm package name, from the
79
- * autolinking.json it passes as `context.autolinking`. React Native passes `{}`
80
- * when it has no autolinking data, and a root it recorded can be gone after a
81
- * reinstall, so only roots that are on disk are kept.
82
- */
84
+ const CORE_POD = 'ExpoModulesCore';
85
+
86
+ /** npm name → autolinked root, only for roots still on disk. */
83
87
  function collectAutolinkedRoots(autolinking) {
84
88
  const roots = new Map();
85
89
  for (const [packageName, dependency] of Object.entries(autolinking?.dependencies ?? {})) {
@@ -91,44 +95,59 @@ function collectAutolinkedRoots(autolinking) {
91
95
  }
92
96
 
93
97
  /**
94
- * A pod's identity — where its npm package lives, what its product is called,
95
- * and whether the Expo prebuild pipeline can build it into an XCFramework.
98
+ * Root: documented (if on disk) → autolinked → walk. The product name can differ from
99
+ * the pod name (react-native-skia → RNSkia).
96
100
  *
97
- * The document covers only packages that ship an spm.config.json; React Native's
98
- * autolinked root answers for the rest, and the filesystem walk stays as the
99
- * fallback for a sync that gets no autolinking data. A documented root that is
100
- * gone falls back too — a stale entry is not identity — but its product name
101
- * still holds.
102
- *
103
- * The pod name is NOT the product name — react-native-skia ships RNSkia — so
104
- * the product is what artifacts and prebuild diagnostics are named after.
101
+ * `declaringRoot` is the root of the package that lists the pod: the document is keyed
102
+ * by pod name, so it documents only one of two packages that list the same pod. A
103
+ * podspec dir that is gone is its own declaring root, or two missing packages would
104
+ * walk up to one ancestor and pass for one.
105
105
  */
106
- function podIdentity(entry, pod, packageName, autolinkedRoot) {
107
- const documentedRoot = documentedPackageRoot(entry);
106
+ function podIdentity(record, pod, packageName, autolinkedRoot, scanSources) {
107
+ const documentedRoot = documentedPackageRoot(record);
108
+ const walkedRoot = autolinkedRoot ?? findModuleRoot(pod.podspecDir);
109
+ const declaringRoot =
110
+ autolinkedRoot == null && !fs.existsSync(pod.podspecDir) ? pod.podspecDir : walkedRoot;
111
+ const moduleRoot = documentedRoot ?? walkedRoot;
108
112
  return {
109
- entry,
113
+ podName: pod.podName,
110
114
  packageName,
111
115
  documentedRoot,
112
116
  autolinkedRoot,
113
- moduleRoot: documentedRoot ?? autolinkedRoot ?? findModuleRoot(pod.podspecDir),
114
- productName: entry?.productName ?? pod.podName,
117
+ declaringRoot,
118
+ moduleRoot,
119
+ productName: record?.productName ?? pod.podName,
115
120
  prebuildProduct:
116
- entry != null ? { name: entry.productName, sourceOnly: entry.sourceOnly === true } : null,
121
+ record != null ? { name: record.productName, sourceOnly: record.sourceOnly } : null,
122
+ iosDeploymentTarget: record?.iosDeploymentTarget ?? null,
123
+ spmPackages: record?.spmPackages ?? [],
124
+ autolinkWhen: record?.autolinkWhen ?? null,
125
+ sources: scanSources(moduleRoot),
126
+ podspec: readPodspecFacts({ podName: pod.podName, podspecDir: pod.podspecDir, moduleRoot }),
117
127
  };
118
128
  }
119
129
 
120
- /** Every pod's identity, keyed by the pod, resolved once so every pass agrees on it. */
130
+ /**
131
+ * Every pod's identity, keyed by the pod, resolved once so every pass agrees on it.
132
+ *
133
+ * @param metadata `readPrebuiltMetadata()`: records by pod name.
134
+ */
121
135
  function resolvePodIdentities(modules, metadata, autolinkedRoots) {
136
+ const sourceScans = new Map();
137
+ const scanSources = (moduleRoot) =>
138
+ sourceScans.get(moduleRoot) ??
139
+ sourceScans.set(moduleRoot, scanAppleSources(moduleRoot)).get(moduleRoot);
122
140
  const identities = new Map();
123
141
  for (const mod of modules) {
124
142
  for (const pod of mod.pods ?? []) {
125
143
  identities.set(
126
144
  pod,
127
145
  podIdentity(
128
- metadata[pod.podName],
146
+ metadata.get(pod.podName),
129
147
  pod,
130
148
  mod.packageName,
131
- autolinkedRoots.get(mod.packageName)
149
+ autolinkedRoots.get(mod.packageName),
150
+ scanSources
132
151
  )
133
152
  );
134
153
  }
@@ -136,34 +155,454 @@ function resolvePodIdentities(modules, metadata, autolinkedRoots) {
136
155
  return identities;
137
156
  }
138
157
 
139
- // Expo modules use Swift macros (@Field, @Record, @OptimizedFunction). A macro expands
140
- // only when the compiler is handed the macro plugin executable, which ships prebuilt and
141
- // declares no SwiftPM products — so it travels as a compiler flag, not a dependency.
142
- // CocoaPods resolves the same binary the same way in
143
- // `expo-modules-autolinking/scripts/ios/project_integrator.rb#resolve_macros_plugin_dir`.
158
+ /**
159
+ * `autolinkWhen` by package root, then product name (first entry wins). Read from the
160
+ * document: autolinking never resolves a companion pod such as expo-camera's barcode scanner.
161
+ */
162
+ function indexAutolinkConditions(metadata) {
163
+ const byRoot = new Map();
164
+ for (const { packageRoot, productName, autolinkWhen } of metadata.values()) {
165
+ if (packageRoot == null) continue;
166
+ const root = path.resolve(packageRoot);
167
+ const products = byRoot.get(root) ?? new Map();
168
+ byRoot.set(root, products);
169
+ if (!products.has(productName)) products.set(productName, autolinkWhen);
170
+ }
171
+ return byRoot;
172
+ }
173
+
174
+ /**
175
+ * The gate for one product of the module at `moduleRoot`, or null when it declares
176
+ * none. A product no entry matches stays ungated: withholding one because a path
177
+ * failed to line up would drop a module with no diagnostic at all.
178
+ */
179
+ function productAutolinkCondition(autolinkConditions, moduleRoot, productName) {
180
+ return autolinkConditions.get(path.resolve(moduleRoot))?.get(productName) ?? null;
181
+ }
182
+
183
+ /**
184
+ * The gated products autolinking never resolves as a pod, by package root: companions
185
+ * such as expo-camera's barcode scanner, which only a checked-in manifest links.
186
+ */
187
+ function indexGatedCompanions(metadata, records) {
188
+ const byRoot = new Map();
189
+ for (const [podName, { packageRoot, productName, autolinkWhen }] of metadata) {
190
+ if (autolinkWhen == null || packageRoot == null || records.has(podName)) continue;
191
+ const root = path.resolve(packageRoot);
192
+ byRoot.set(root, [...(byRoot.get(root) ?? []), { podName, productName, autolinkWhen }]);
193
+ }
194
+ return byRoot;
195
+ }
196
+
197
+ /**
198
+ * Only a checked-in manifest's products have their autolinkWhen checked. A gated pod
199
+ * linked any other way fails the sync whichever way its condition falls. Its module's
200
+ * gated companions are left out, which differs from CocoaPods only where a companion's
201
+ * condition is met. Such a companion fails the sync only when a Podfile property
202
+ * decides it, because the app can switch that off; a pod or npm package condition is
203
+ * met by what the app installs for its own reasons, so refusing it would block the app.
204
+ *
205
+ * @param linked the precompiled and pure-Swift records, in pass order.
206
+ * @returns the `refusals` that fail the sync, and the `leftOutCompanions` to warn about.
207
+ */
208
+ function uncheckedAutolinkConditions(linked, { gatedCompanions, manifestRoots, autolinkGate }) {
209
+ const companionRootsSeen = new Set();
210
+ const refusals = [];
211
+ const leftOutCompanions = [];
212
+ for (const { identity, linkedAs } of linked) {
213
+ const { podName, packageName, moduleRoot, productName, autolinkWhen } = identity;
214
+ const subject = { packageName, moduleRoot, precompiled: linkedAs === 'precompiled' };
215
+ const refusal = { reason: 'unchecked-autolink-condition', ...subject };
216
+ if (autolinkWhen != null) refusals.push({ ...refusal, podName, productName });
217
+ const root = path.resolve(moduleRoot);
218
+ if (manifestRoots.has(root) || companionRootsSeen.has(root)) continue;
219
+ companionRootsSeen.add(root);
220
+ for (const companion of gatedCompanions.get(root) ?? []) {
221
+ if (!autolinkConditionMet(companion.autolinkWhen, autolinkGate)) continue;
222
+ if (autolinkConditionKey(companion.autolinkWhen) === 'podfileProperty') {
223
+ refusals.push({ ...refusal, ...companion, linkedThrough: podName });
224
+ } else {
225
+ leftOutCompanions.push({ ...subject, ...companion, linkedThrough: podName });
226
+ }
227
+ }
228
+ }
229
+ return { refusals, leftOutCompanions };
230
+ }
231
+
232
+ /**
233
+ * The gated companions a checked-in manifest does not export, where their condition
234
+ * is met: there CocoaPods would link them. Matched by real path, because a companion's
235
+ * documented root and its module's root can reach one directory through different
236
+ * symlinks.
237
+ */
238
+ function companionsNotExportedByManifests(emitted, { gatedCompanions, autolinkGate }) {
239
+ const companionsByRealRoot = new Map();
240
+ for (const [root, companions] of gatedCompanions) {
241
+ const realRoot = realPathOrSelf(root);
242
+ companionsByRealRoot.set(realRoot, [
243
+ ...(companionsByRealRoot.get(realRoot) ?? []),
244
+ ...companions,
245
+ ]);
246
+ }
247
+ return emitted
248
+ .filter((r) => r.linkedAs === 'manifest')
249
+ .flatMap(({ identity: { packageName, moduleRoot }, emission }) => {
250
+ const exported = new Set(emission.productDeps.map((dep) => dep.name));
251
+ return (companionsByRealRoot.get(realPathOrSelf(moduleRoot)) ?? [])
252
+ .filter(
253
+ (companion) =>
254
+ !exported.has(companion.productName) &&
255
+ autolinkConditionMet(companion.autolinkWhen, autolinkGate)
256
+ )
257
+ .map((companion) => ({
258
+ reason: 'companion-not-exported-by-manifest',
259
+ packageName,
260
+ moduleRoot,
261
+ ...companion,
262
+ }));
263
+ });
264
+ }
265
+
266
+ /**
267
+ * A pod nothing covers, with every refusal that applies to it: those recorded at
268
+ * its module root, if any, and what its identity alone says. `classifyUnsupported`
269
+ * reports the most specific of them.
270
+ */
271
+ function uncoveredPod(identity, ...refusals) {
272
+ const { podName, packageName, moduleRoot, prebuildProduct, sources } = identity;
273
+ const productName = prebuildProduct?.name ?? null;
274
+ const prebuildable = prebuildProduct != null && !prebuildProduct.sourceOnly;
275
+ const ownReport = {
276
+ reason: sources.hasSources ? 'mixed-no-manifest' : 'no-apple-sources',
277
+ productName,
278
+ };
279
+ const candidates = [
280
+ ...refusals,
281
+ prebuildable ? { reason: 'prebuild-available', productName } : null,
282
+ ownReport,
283
+ ];
284
+ return { podName, packageName, moduleRoot, refusals: candidates.filter((r) => r != null) };
285
+ }
286
+
287
+ /**
288
+ * What the passes decided for each pod, keyed by pod name: CocoaPods pod names are
289
+ * unique, so a name two packages list is one pod. `linkedAs` is `'precompiled'`,
290
+ * `'manifest'`, `'pure-swift'` or null. A precompiled record carries its
291
+ * `framework`.
292
+ */
293
+ function podRecords(identities) {
294
+ const records = new Map();
295
+ for (const identity of identities.values()) {
296
+ if (!records.has(identity.podName)) {
297
+ records.set(identity.podName, { identity, linkedAs: null });
298
+ }
299
+ }
300
+ return records;
301
+ }
302
+
303
+ /**
304
+ * Pass 1 — precompiled runtime frameworks. The declaration is all-or-nothing:
305
+ * once one flavor exists, the resolver requires and prepares both before RN
306
+ * receives the plugin result. No runtime binary enters the SwiftPM graph.
307
+ * A pod name several packages list is looked up from each of them, in order,
308
+ * until one has an artifact. Returns the records it linked, in that order.
309
+ */
310
+ function linkPrecompiledPods(identities, records, cacheDir) {
311
+ const linked = [];
312
+ for (const identity of identities.values()) {
313
+ const record = records.get(identity.podName);
314
+ if (record.linkedAs != null) continue;
315
+ const framework = resolveFlavoredFramework({
316
+ packageName: identity.packageName,
317
+ moduleRoot: identity.moduleRoot,
318
+ frameworkName: identity.productName,
319
+ cacheDir,
320
+ });
321
+ if (framework == null) continue;
322
+ Object.assign(record, { identity, linkedAs: 'precompiled', framework });
323
+ linked.push(record);
324
+ }
325
+ return linked;
326
+ }
327
+
328
+ /**
329
+ * Emits the source package of the module whose first pod is `identity`: its
330
+ * checked-in manifest mirrored, or else one Swift target over its sources. A
331
+ * pure-Swift module is refused when its podspec declares linkage, because the
332
+ * emitted package would link less than the podspec does. Returns null for a module
333
+ * with no sources: the pod's own `no-apple-sources` report covers it.
334
+ */
335
+ function emitSourceModule(identity, hasManifest, emitContext) {
336
+ const { moduleRoot, podName, iosDeploymentTarget, spmPackages, sources, podspec } = identity;
337
+ if (hasManifest) return emitSourceManifestPackage(moduleRoot, emitContext);
338
+ if (podspec.linkage != null) {
339
+ return { refusal: { reason: 'needs-manifest-for-linkage', ...podspec.linkage } };
340
+ }
341
+ if (!sources.hasSources) return null;
342
+ return emitPureSwiftSourcePackage(
343
+ { moduleRoot, product: podName, iosDeploymentTarget, spmPackages, sources },
344
+ emitContext
345
+ );
346
+ }
347
+
348
+ /**
349
+ * Pass 2 — invariant source modules. They compile against the generated
350
+ * headers/module-interface tree and leave runtime linking entirely to RN.
351
+ *
352
+ * @param emitContext what every emitted package is generated against.
353
+ * @returns `emitted`, one `{ identity, linkedAs, emission }` per package it emitted, in
354
+ * emission order, `identity` being the pod it was emitted for; and `refusals`, by
355
+ * module root and then reason, each a function from an uncovered pod's identity to
356
+ * its refusal.
357
+ */
358
+ function linkSourceModules(modules, identities, records, emitContext) {
359
+ const emitted = [];
360
+ const refusals = new Map();
361
+ // What the branches below read comes from the first pod's module root, so a
362
+ // refusal they record applies to every uncovered pod at that root, whichever
363
+ // package lists it.
364
+ const refuse = (root, reason, refusalFor) =>
365
+ refusals.set(root, (refusals.get(root) ?? new Map()).set(reason, refusalFor));
366
+ const linkedAs = (identity) => records.get(identity.podName).linkedAs;
367
+ const manifestProductsByRoot = new Map();
368
+ for (const mod of modules) {
369
+ const pods = (mod.pods ?? []).map((pod) => identities.get(pod));
370
+ if (!pods.length || pods.every(linkedAs)) continue;
371
+
372
+ const [first] = pods;
373
+ const { moduleRoot, sources } = first;
374
+ const hasManifest = fs.existsSync(path.join(moduleRoot, 'Package.swift'));
375
+
376
+ const precompiledSiblings = pods.filter((p) => linkedAs(p) === 'precompiled');
377
+ if (precompiledSiblings.length > 0 && (hasManifest || sources.pureSwift)) {
378
+ // Both source branches build the whole module, so emitting it would link
379
+ // the precompiled pods a second time, from source.
380
+ const siblings = {
381
+ precompiledSiblings: precompiledSiblings.map((p) => p.podName),
382
+ precompiledProducts: precompiledSiblings.map((p) => p.productName),
383
+ artifactDirs: artifactBaseDirs(mod.packageName, moduleRoot),
384
+ };
385
+ refuse(moduleRoot, 'partially-precompiled', (p) => ({
386
+ reason: 'partially-precompiled',
387
+ ...siblings,
388
+ prebuildProduct: p.prebuildProduct,
389
+ }));
390
+ continue;
391
+ }
392
+ // A manifest is emitted once, by whichever listing reaches it first; every listing
393
+ // then links the pods whose product it exports, so the order they come in decides
394
+ // nothing.
395
+ const realRoot = hasManifest ? fs.realpathSync(moduleRoot) : null;
396
+ let manifestProducts = manifestProductsByRoot.get(realRoot);
397
+ if (manifestProducts == null) {
398
+ // Only this pod is built; siblings must stay pending to be diagnosed.
399
+ const covered = hasManifest ? pods : [first];
400
+ if (covered.some(linkedAs)) continue;
401
+ // A module with no sources at all scans as pure Swift too, so it reaches
402
+ // emitSourceModule for the podspec linkage check that outranks it.
403
+ if (!hasManifest && !sources.pureSwift) continue;
404
+
405
+ const emission = emitSourceModule(first, hasManifest, emitContext);
406
+ if (emission == null) continue;
407
+ const { refusal, ok } = emission;
408
+ if (refusal != null) {
409
+ refuse(moduleRoot, refusal.reason, () => refusal);
410
+ continue;
411
+ }
412
+ const kind = hasManifest ? 'manifest' : 'pure-swift';
413
+ emitted.push({ identity: first, linkedAs: kind, emission: ok });
414
+ if (!hasManifest) {
415
+ Object.assign(records.get(first.podName), { identity: first, linkedAs: kind });
416
+ continue;
417
+ }
418
+ manifestProducts = new Set(ok.productDeps.map((dep) => dep.name));
419
+ manifestProductsByRoot.set(realRoot, manifestProducts);
420
+ }
421
+ for (const p of pods) {
422
+ if (linkedAs(p)) continue;
423
+ if (manifestProducts.has(p.productName)) {
424
+ Object.assign(records.get(p.podName), { identity: p, linkedAs: 'manifest' });
425
+ } else {
426
+ refuse(moduleRoot, 'not-exported-by-manifest', (u) => ({
427
+ reason: 'not-exported-by-manifest',
428
+ productName: u.productName,
429
+ exportedProducts: [...manifestProducts],
430
+ }));
431
+ }
432
+ }
433
+ }
434
+ return { emitted, refusals };
435
+ }
436
+
437
+ /**
438
+ * The emitted products React Native links, and a label for each one an unmet
439
+ * `autolinkWhen` condition withholds. Only a checked-in manifest's products are
440
+ * checked: its emitted package keeps every target, and a withheld product is simply
441
+ * never depended on, so SwiftPM never builds it.
442
+ */
443
+ function gateProducts(emitted, autolinkConditions, autolinkGate) {
444
+ const productDependencies = [];
445
+ const gatedOffProducts = [];
446
+ for (const { identity, linkedAs, emission } of emitted) {
447
+ for (const dep of emission.productDeps) {
448
+ const condition =
449
+ linkedAs === 'manifest'
450
+ ? productAutolinkCondition(autolinkConditions, identity.moduleRoot, dep.name)
451
+ : null;
452
+ if (condition != null && !autolinkConditionMet(condition, autolinkGate)) {
453
+ gatedOffProducts.push(
454
+ `${dep.name} (${autolinkConditionLabel(condition) ?? 'unrecognized condition'})`
455
+ );
456
+ } else {
457
+ productDependencies.push(dep);
458
+ }
459
+ }
460
+ }
461
+ return { productDependencies, gatedOffProducts };
462
+ }
463
+
464
+ /**
465
+ * Everything that follows from the pod records once both passes ran: the source
466
+ * packages and products React Native links, the pods nothing covers, the
467
+ * diagnostics, and what each pass linked. Each check runs once per pod, in pass
468
+ * order — the precompiled pods, then the modules pass 2 emitted. `precompiled` is
469
+ * what `linkPrecompiledPods` returned; `emitted` and `refusals` are what
470
+ * `linkSourceModules` returned; `gatedCompanions` is what `indexGatedCompanions` returned.
471
+ *
472
+ * @param satisfiedDependencies the SwiftPM packages already declared as frameworks.
473
+ */
474
+ function summarizeRecords(
475
+ records,
476
+ {
477
+ precompiled,
478
+ emitted,
479
+ refusals,
480
+ react,
481
+ satisfiedDependencies,
482
+ autolinkConditions,
483
+ gatedCompanions,
484
+ autolinkGate,
485
+ }
486
+ ) {
487
+ const pureSwift = emitted.filter((r) => r.linkedAs === 'pure-swift');
488
+ const refusalsFor = (identity) =>
489
+ [...(refusals.get(identity.moduleRoot)?.values() ?? [])].map((refusalFor) =>
490
+ refusalFor(identity)
491
+ );
492
+ const pending = [...records.values()]
493
+ .filter((r) => r.linkedAs == null)
494
+ .map(({ identity }) => uncoveredPod(identity, ...refusalsFor(identity)));
495
+
496
+ // What the resolved dependencies already carry is not uncovered, their subspecs
497
+ // included.
498
+ const unmappedDeps = [...precompiled, ...emitted]
499
+ .map((record) => ({
500
+ packageName: record.identity.packageName,
501
+ podName: record.identity.podName,
502
+ pods: unmappedPodDependencies(
503
+ record.identity.podspec.dependencies,
504
+ new Set([...satisfiedDependencies, ...(record.emission?.spmProductNames ?? [])])
505
+ ),
506
+ }))
507
+ .filter((entry) => entry.pods.length > 0);
508
+ const unchecked = uncheckedAutolinkConditions([...precompiled, ...pureSwift], {
509
+ gatedCompanions,
510
+ manifestRoots: new Set(
511
+ emitted
512
+ .filter((r) => r.linkedAs === 'manifest')
513
+ .map((r) => path.resolve(r.identity.moduleRoot))
514
+ ),
515
+ autolinkGate,
516
+ });
517
+ const unexportedCompanions = companionsNotExportedByManifests(emitted, {
518
+ gatedCompanions,
519
+ autolinkGate,
520
+ });
521
+ const xcconfigLinkage = pureSwift
522
+ .filter(({ identity }) => identity.podspec.linkerFlags != null)
523
+ .map(({ identity }) => ({
524
+ packageName: identity.packageName,
525
+ podName: identity.podName,
526
+ ...identity.podspec.linkerFlags,
527
+ }));
528
+
529
+ const reactWired = [
530
+ ...precompiled.filter(({ identity }) => moduleNeedsReact(identity.podName, identity.sources)),
531
+ ...(react != null ? emitted : []),
532
+ ];
533
+ const podNames = (list) => list.map((r) => r.identity.podName);
534
+
535
+ return {
536
+ packageDependencies: emitted.map((r) => r.emission.packageDep),
537
+ ...gateProducts(emitted, autolinkConditions, autolinkGate),
538
+ pending,
539
+ uncheckedConditions: unchecked.refusals,
540
+ leftOutCompanions: unchecked.leftOutCompanions,
541
+ unexportedCompanions,
542
+ unmappedDeps,
543
+ partlyProvidedPackages: emitted.flatMap(({ identity: { packageName, moduleRoot }, emission }) =>
544
+ emission.partlyProvidedPackages.map((pkg) => ({ packageName, moduleRoot, ...pkg }))
545
+ ),
546
+ xcconfigLinkage,
547
+ precompiledPods: podNames(precompiled),
548
+ manifestPackages: emitted
549
+ .filter((r) => r.linkedAs === 'manifest')
550
+ .map((r) => r.identity.packageName),
551
+ pureSwiftPods: podNames(pureSwift),
552
+ reactWiredPods: podNames(reactWired),
553
+ };
554
+ }
555
+
556
+ /**
557
+ * The staleness inputs (`watchPaths` plugin contract) whose edits must trip RN's
558
+ * in-build re-sync: each module's checked-in Package.swift and
559
+ * expo-module.config.json, which drive the generated packages and module
560
+ * resolution; and the registry's app-target inputs — app groups come from the
561
+ * entitlements file, inline-module registration from Podfile.properties.json.
562
+ * Known gap: repointing CODE_SIGN_ENTITLEMENTS at a different file is not noticed,
563
+ * because that would mean watching project.pbxproj — which RN rewrites during the
564
+ * sync itself.
565
+ */
566
+ function watchPaths(identities, { entitlementPath, podfilePropertiesPath }) {
567
+ const moduleRoots = new Set([...identities.values()].map((identity) => identity.moduleRoot));
568
+ return [
569
+ ...collectWatchPaths([...moduleRoots]),
570
+ ...[entitlementPath, podfilePropertiesPath].filter((p) => p != null),
571
+ ];
572
+ }
573
+
574
+ // Swift macros need the prebuilt plugin executable; mirrors
575
+ // project_integrator.rb#resolve_macros_plugin_dir.
576
+ // It declares no SwiftPM products, so it travels as a compiler flag, not a dependency.
144
577
  function macroPluginFlags(coreModuleRoot) {
578
+ const macroPluginFault = (
579
+ what,
580
+ missing,
581
+ how = 'Reinstall your JavaScript dependencies and build again.'
582
+ ) => ({
583
+ what,
584
+ why: `Expo modules are compiled from source here, and their Swift macros cannot expand without ${missing} — the build would fail with "external macro implementation could not be found".`,
585
+ how,
586
+ });
145
587
  let pkgJsonPath;
146
588
  try {
147
589
  pkgJsonPath = require.resolve('expo-modules-macros/package.json', {
148
590
  paths: [coreModuleRoot],
149
591
  });
150
- } catch {
151
- throw new Error(
152
- `[expo-spm-plugin] Could not resolve "expo-modules-macros" from ${coreModuleRoot}. ` +
153
- 'Expo modules are compiled from source here, and their Swift macros cannot expand without ' +
154
- 'this plugin — the build would fail with "external macro implementation could not be found". ' +
155
- '"expo-modules-core" must be a version that depends on "expo-modules-macros", the new name of ' +
156
- '"@expo/expo-modules-macros-plugin". Run `npx expo install --fix` to align the Expo package ' +
157
- 'versions, then build again.'
592
+ } catch (error) {
593
+ throw pluginError(
594
+ macroPluginFault(
595
+ `Could not resolve "expo-modules-macros" from ${coreModuleRoot}.`,
596
+ 'this plugin',
597
+ '"expo-modules-core" must be a version that depends on "expo-modules-macros", the new name of "@expo/expo-modules-macros-plugin". Run `npx expo install --fix` to align the Expo package versions, then build again.'
598
+ ),
599
+ { cause: error }
158
600
  );
159
601
  }
160
602
  const tool = path.join(path.dirname(pkgJsonPath), 'apple', 'ExpoModulesMacros');
161
603
  if (!fs.existsSync(tool)) {
162
- throw new Error(
163
- `[expo-spm-plugin] The Expo Swift macro plugin is missing its executable at ${tool}. ` +
164
- 'Expo modules are compiled from source here, and their Swift macros cannot expand without ' +
165
- 'it — the build would fail with "external macro implementation could not be found". ' +
166
- 'Reinstall your JavaScript dependencies and build again.'
604
+ throw pluginError(
605
+ macroPluginFault(`The Expo Swift macro plugin is missing its executable at ${tool}.`, 'it')
167
606
  );
168
607
  }
169
608
  return ['-Xfrontend', '-load-plugin-executable', '-Xfrontend', `${tool}#ExpoModulesMacros`];
@@ -179,9 +618,29 @@ module.exports = function expoSpmPlugin(context) {
179
618
  // us that root directly.
180
619
  const appRoot = context.projectRoot;
181
620
  const { modules, extraDependencies } = resolveExpoModules(appRoot);
182
- const metadata = prebuiltMetadata(appRoot);
621
+ const metadata = readPrebuiltMetadata(appRoot);
183
622
  const autolinkedRoots = collectAutolinkedRoots(autolinking);
184
623
  const identities = resolvePodIdentities(modules, metadata, autolinkedRoots);
624
+ // Before either pass: which copy of a pod the passes reached first depends on the
625
+ // order the packages were autolinked in, so linking any of them would too.
626
+ const duplicatePods = reportUnsupported(collectDuplicatePods(identities));
627
+ if (duplicatePods != null) {
628
+ throw duplicatePods;
629
+ }
630
+ const autolinkConditions = indexAutolinkConditions(metadata);
631
+ // Read once so gating and registry agree.
632
+ const appTarget = resolveAppTarget(context.appRoot);
633
+ const autolinkGate = {
634
+ // Every pod the install DECLARES, not the ones linked: a declared pod
635
+ // CocoaPods links is a satisfied condition here too.
636
+ declaredPodNames: new Set(metadata.keys()),
637
+ // CocoaPods counts React Native's autolinked packages by key, root on disk or not.
638
+ autolinkedPackages: new Set([
639
+ ...modules.map((m) => m.packageName),
640
+ ...Object.keys(autolinking?.dependencies ?? {}),
641
+ ]),
642
+ podfileProperties: readPodfileProperties(appTarget.podfilePropertiesPath),
643
+ };
185
644
  const outDir = path.join(outputDir, 'expo');
186
645
  // The old contract generated mutable binaryTarget packages here. They are
187
646
  // invalid under automatic configuration selection and must never survive a
@@ -195,218 +654,82 @@ module.exports = function expoSpmPlugin(context) {
195
654
  ? codegenCandidate
196
655
  : null;
197
656
 
198
- const packageDependencies = [];
199
- const productDependencies = [];
200
- const emitted = new Set(); // pod names already contributed
201
- const reactWired = []; // pods that got React wired (for logging)
202
- const sourceManifest = []; // packages emitted from a checked-in manifest
203
- const pureSwiftSource = []; // packages emitted from a pure-Swift descriptor
204
- const unmappedDeps = []; // emitted pods depending on pods with no SwiftPM counterpart
205
- const xcconfigLinkage = []; // emitted pods whose podspec xcconfig sets linker flags
206
- const unresolvedTargets = new Map(); // module root → manifest targets with no sources on disk
207
- const unsupportedTargetDeps = new Map(); // module root → deps the generated package cannot declare
208
- const podspecLinkage = new Map(); // module root → podspec line declaring native linkage
209
-
210
- // Pass 1 — precompiled runtime frameworks. The declaration is all-or-nothing:
211
- // once one flavor exists, the resolver requires and prepares both before RN
212
- // receives the plugin result. No runtime binary enters the SwiftPM graph.
213
- const precompiledFrameworks = new Map();
214
- const flavoredFrameworks = [];
215
- const precompiledPods = [];
216
- let coreModuleRoot = null;
217
- for (const mod of modules) {
218
- for (const pod of mod.pods ?? []) {
219
- if (emitted.has(pod.podName)) continue;
220
- const { entry, moduleRoot, productName } = identities.get(pod);
221
- if (pod.podName === 'ExpoModulesCore') coreModuleRoot = moduleRoot;
222
- const needsReact = moduleNeedsReact(pod.podName, moduleRoot);
223
- const framework = resolveFlavoredFramework({
224
- packageName: mod.packageName,
225
- moduleRoot,
226
- frameworkName: productName,
227
- cacheDir: artifactCacheDir,
228
- });
229
- if (framework != null) {
230
- precompiledFrameworks.set(pod.podName, framework);
231
- flavoredFrameworks.push(framework);
232
- precompiledPods.push({
233
- packageName: mod.packageName,
234
- podName: pod.podName,
235
- podspecDir: pod.podspecDir,
236
- moduleRoot,
237
- spmDependencies: entry?.spmDependencies,
238
- });
239
- emitted.add(pod.podName);
240
- if (needsReact) reactWired.push(pod.podName);
241
- }
242
- }
243
- }
657
+ const records = podRecords(identities);
658
+ const precompiled = linkPrecompiledPods(identities, records, artifactCacheDir);
244
659
  // The SwiftPM packages those modules link ship as their own XCFrameworks, and
245
660
  // RN takes them in the same flat array. They join before the interface tree is
246
661
  // built, so source modules compile against their headers too.
247
- const dependencyFrameworks = resolveSpmDependencyFrameworks(precompiledPods);
248
- flavoredFrameworks.push(...dependencyFrameworks);
249
- flavoredFrameworks.sort((a, b) => byteOrder(a.id, b.id));
662
+ const dependencyFrameworks = resolveSpmDependencyFrameworks(
663
+ precompiled.map(({ identity: { podName, moduleRoot, spmPackages } }) => ({
664
+ podName,
665
+ moduleRoot,
666
+ spmDependencies: spmPackages.map((pkg) => pkg.productName),
667
+ }))
668
+ );
669
+ const flavoredFrameworks = [...precompiled.map((r) => r.framework), ...dependencyFrameworks].sort(
670
+ (a, b) => byteOrder(a.id, b.id)
671
+ );
250
672
  assertDistinctFlavoredFrameworks(flavoredFrameworks);
251
-
252
- // Pass 2 reports this for the modules it emits, which a precompiled pod reaches
253
- // only when a sibling pod of its package is not precompiled — so the report for
254
- // precompiled pods belongs here. What the resolved dependencies already carry is
255
- // not uncovered, their subspecs included.
256
673
  const satisfiedDependencies = new Set(dependencyFrameworks.map((f) => f.frameworkName));
257
- for (const { packageName, podName, podspecDir } of precompiledPods) {
258
- const unmapped = collectUnmappedDependencies(podspecDir, satisfiedDependencies);
259
- if (unmapped.length > 0) {
260
- unmappedDeps.push({ packageName, podName, pods: unmapped });
261
- }
262
- }
263
674
  const frameworkSearchPath =
264
- precompiledFrameworks.size > 0
675
+ precompiled.length > 0
265
676
  ? prepareCompileInterfaces(flavoredFrameworks, path.join(outDir, 'compile-interfaces'))
266
677
  : null;
267
678
 
268
- // Pass 2 — invariant source modules. They compile against the generated
269
- // headers/module-interface tree and leave runtime linking entirely to RN.
270
- const coreAvailable = precompiledFrameworks.has('ExpoModulesCore') && frameworkSearchPath != null;
271
- // Every module imports ExpoModulesCore, so none may be built below its floor —
272
- // the CocoaPods installer raises them the same way, after install.
273
- const coreDeploymentTarget = metadata['ExpoModulesCore']?.iosDeploymentTarget ?? null;
679
+ const core = precompiled.find((r) => r.identity.podName === CORE_POD)?.identity ?? null;
680
+ const coreAvailable = core != null && frameworkSearchPath != null;
681
+ let sourceModules = { emitted: [], refusals: new Map() };
274
682
  if (coreAvailable) {
275
- // Every emitted source target compiles against the same ExpoModulesCore interface tree,
276
- // so every one of them may use the macros — the set CocoaPods reaches through its
277
- // "is core or depends on core" gate. Resolved on first use so an install that emits
278
- // no source package at all does not need the macro plugin present.
279
683
  let resolvedMacroFlags = null;
280
- const macroFlags = () => (resolvedMacroFlags ??= macroPluginFlags(coreModuleRoot));
281
- for (const mod of modules) {
282
- const pods = mod.pods ?? [];
283
- if (!pods.length || pods.every((p) => emitted.has(p.podName))) continue;
284
- const pod = pods[0];
285
- const { entry, moduleRoot } = identities.get(pod);
286
-
287
- if (fs.existsSync(path.join(moduleRoot, 'Package.swift'))) {
288
- // Module ships a checked-in Package.swift → mirror its targets + inject deps.
289
- const e = emitSourceManifestPackage({
290
- moduleRoot,
291
- react,
292
- frameworkSearchPath,
293
- outDir,
294
- codegenPkgPath,
295
- minimumIosDeploymentTarget: coreDeploymentTarget,
296
- macroFlags: macroFlags(),
297
- });
298
- if (e.unsupportedTargetDeps != null) {
299
- unsupportedTargetDeps.set(moduleRoot, e.unsupportedTargetDeps);
300
- } else if (e.unresolvedTargets != null) {
301
- unresolvedTargets.set(moduleRoot, e.unresolvedTargets);
302
- } else {
303
- packageDependencies.push(e.packageDep);
304
- productDependencies.push(...e.productDeps);
305
- pods.forEach((p) => emitted.add(p.podName));
306
- sourceManifest.push(mod.packageName);
307
- if (react != null) reactWired.push(pod.podName);
308
- }
309
- } else if (isPureSwift(moduleRoot)) {
310
- // Pure-Swift module → single Swift target over its ios sources. Its podspec is
311
- // only read for what would make the emission wrong: a module whose linkage only
312
- // the podspec declares is skipped and diagnosed, never emitted half-linked.
313
- const podspecs = readPodspecs(
314
- pod.podName,
315
- [
316
- pod.podspecDir,
317
- ...APPLE_SOURCE_DIRS.map((dir) => path.join(moduleRoot, dir)),
318
- moduleRoot,
319
- ].filter(Boolean)
320
- );
321
- if (podspecs.linkage != null) podspecLinkage.set(moduleRoot, podspecs.linkage);
322
- const e =
323
- podspecs.linkage != null
324
- ? null
325
- : emitPureSwiftSourcePackage({
326
- moduleRoot,
327
- product: pod.podName,
328
- react,
329
- frameworkSearchPath,
330
- outDir,
331
- codegenPkgPath,
332
- iosDeploymentTarget: raiseFloor(entry?.iosDeploymentTarget, coreDeploymentTarget),
333
- macroFlags: macroFlags(),
334
- });
335
- if (e != null) {
336
- packageDependencies.push(e.packageDep);
337
- productDependencies.push(e.productDep);
338
- pods.forEach((p) => emitted.add(p.podName));
339
- pureSwiftSource.push(pod.podName);
340
- if (react != null) reactWired.push(pod.podName);
341
- if (podspecs.linkerFlags != null) {
342
- xcconfigLinkage.push({
343
- packageName: mod.packageName,
344
- podName: pod.podName,
345
- ...podspecs.linkerFlags,
346
- });
347
- }
348
- }
349
- }
350
-
351
- // A precompiled pod was already diagnosed in pass 1. It still reaches here
352
- // when a sibling pod of the same package is not precompiled, and warning
353
- // again would print the identical block twice.
354
- if (emitted.has(pod.podName) && !precompiledFrameworks.has(pod.podName)) {
355
- const unmapped = collectUnmappedDependencies(pod.podspecDir, satisfiedDependencies);
356
- if (unmapped.length > 0) {
357
- unmappedDeps.push({
358
- packageName: mod.packageName,
359
- podName: pod.podName,
360
- pods: unmapped,
361
- });
362
- }
363
- }
364
- }
684
+ sourceModules = linkSourceModules(modules, identities, records, {
685
+ react,
686
+ frameworkSearchPath,
687
+ outDir,
688
+ codegenPkgPath,
689
+ minimumIosDeploymentTarget: core.iosDeploymentTarget,
690
+ satisfiedDependencies,
691
+ // Every emitted target may use the macros (CocoaPods' "is core or depends on core" gate).
692
+ // Lazy: an install that emits no source package needs no macro plugin.
693
+ get macroFlags() {
694
+ return (resolvedMacroFlags ??= macroPluginFlags(core.moduleRoot));
695
+ },
696
+ });
365
697
  }
366
698
 
367
699
  // Anything still uncovered has no xcframework and no way to be built from
368
- // source. Collect the facts each diagnostic needs, then report and fail —
369
- // dropping a module here would surface as a runtime "Cannot find native
370
- // module" instead of a build error.
371
- const pending = [];
372
- for (const mod of modules) {
373
- for (const pod of mod.pods ?? []) {
374
- if (emitted.has(pod.podName)) continue;
375
- const { moduleRoot, prebuildProduct } = identities.get(pod);
376
- pending.push({
377
- podName: pod.podName,
378
- packageName: mod.packageName,
379
- moduleRoot,
380
- pureSwift: isPureSwift(moduleRoot),
381
- hasSources: appleSourceDir(moduleRoot) != null,
382
- unsupportedTargetDeps: unsupportedTargetDeps.get(moduleRoot) ?? null,
383
- unresolvedTargets: unresolvedTargets.get(moduleRoot) ?? null,
384
- podspecLinkage: podspecLinkage.get(moduleRoot) ?? null,
385
- prebuildProduct,
386
- });
387
- }
388
- }
389
-
390
- console.log(
391
- `[expo-spm-plugin] paired runtime frameworks (${precompiledFrameworks.size}): ${[...precompiledFrameworks.keys()].join(', ') || '—'}`
392
- );
393
- console.log(
394
- `[expo-spm-plugin] source via checked-in manifest (${sourceManifest.length}): ${sourceManifest.join(', ') || '—'}`
395
- );
396
- console.log(
397
- `[expo-spm-plugin] source pure-Swift (${pureSwiftSource.length}): ${pureSwiftSource.join(', ') || '—'}`
700
+ // source. Report it and fail — dropping a module here would surface as a
701
+ // runtime "Cannot find native module" instead of a build error.
702
+ const summary = summarizeRecords(records, {
703
+ precompiled,
704
+ ...sourceModules,
705
+ react,
706
+ satisfiedDependencies,
707
+ autolinkConditions,
708
+ gatedCompanions: indexGatedCompanions(metadata, records),
709
+ autolinkGate,
710
+ });
711
+ const logListed = (label, names) =>
712
+ console.log(`[expo-spm-plugin] ${label} (${names.length}): ${names.join(', ') || '—'}`);
713
+ logListed('paired runtime frameworks', summary.precompiledPods);
714
+ logListed('source via checked-in manifest', summary.manifestPackages);
715
+ logListed('source pure-Swift', summary.pureSwiftPods);
716
+ logListed('React wired into', summary.reactWiredPods);
717
+ logListed('gated off', summary.gatedOffProducts);
718
+ logListed(
719
+ 'not supported',
720
+ summary.pending.map((p) => p.podName)
398
721
  );
399
- console.log(
400
- `[expo-spm-plugin] React wired into (${reactWired.length}): ${reactWired.join(', ') || '—'}`
401
- );
402
- console.log(
403
- `[expo-spm-plugin] not supported (${pending.length}): ${pending.map((p) => p.podName).join(', ') || '—'}`
404
- );
405
- if (unmappedDeps.length > 0) {
406
- console.warn(renderUnmappedDependencyWarning(unmappedDeps));
722
+ if (summary.unmappedDeps.length > 0) {
723
+ console.warn(renderUnmappedDependencyWarning(summary.unmappedDeps));
724
+ }
725
+ if (summary.partlyProvidedPackages.length > 0) {
726
+ console.warn(renderPartlyProvidedPackageWarning(summary.partlyProvidedPackages));
407
727
  }
408
- if (xcconfigLinkage.length > 0) {
409
- console.warn(renderXcconfigLinkerWarning(xcconfigLinkage));
728
+ if (summary.xcconfigLinkage.length > 0) {
729
+ console.warn(renderXcconfigLinkerWarning(summary.xcconfigLinkage));
730
+ }
731
+ if (summary.leftOutCompanions.length > 0) {
732
+ console.warn(renderLeftOutCompanionWarning(summary.leftOutCompanions));
410
733
  }
411
734
  const rootConflicts = collectRootConflicts(identities);
412
735
  if (rootConflicts.length > 0) {
@@ -421,7 +744,11 @@ module.exports = function expoSpmPlugin(context) {
421
744
  );
422
745
  }
423
746
 
424
- const unsupported = reportUnsupported(classifyUnsupported({ pending, coreAvailable }));
747
+ const unsupported = reportUnsupported([
748
+ ...classifyUnsupported({ pending: summary.pending, coreAvailable }),
749
+ ...summary.uncheckedConditions,
750
+ ...summary.unexportedCompanions,
751
+ ]);
425
752
  if (unsupported != null) {
426
753
  throw unsupported;
427
754
  }
@@ -434,14 +761,15 @@ module.exports = function expoSpmPlugin(context) {
434
761
  // empty. In the app's main module the class always registers, matching CocoaPods
435
762
  // `use_expo_modules!` (which adds ExpoModulesProvider.swift to the app target).
436
763
  const generatedSources = [];
437
- const appTarget = resolveAppTarget(context.appRoot);
438
764
  let providerPath;
439
765
  try {
440
766
  providerPath = generateModulesProvider({
441
767
  appRoot,
442
768
  outDir,
443
769
  moduleNames: modules.map((m) => m.packageName),
444
- ...appTarget,
770
+ targetName: appTarget.targetName,
771
+ entitlementPath: appTarget.entitlementPath,
772
+ podfilePropertiesPath: appTarget.podfilePropertiesPath,
445
773
  });
446
774
  } catch (error) {
447
775
  throw new Error(
@@ -476,21 +804,6 @@ module.exports = function expoSpmPlugin(context) {
476
804
  console.log(`[expo-spm-plugin] generated ExpoModulesProvider.swift → ${providerPath}`);
477
805
  }
478
806
 
479
- // Staleness inputs (`watchPaths` plugin contract): each module's checked-in
480
- // Package.swift and expo-module.config.json. Editing either must trip RN's
481
- // in-build re-sync — the manifests drive the generated wrapper packages, the
482
- // configs drive module resolution.
483
- const moduleRoots = new Set([...identities.values()].map((identity) => identity.moduleRoot));
484
- // The registry's other inputs: app groups come from the entitlements file and
485
- // inline-module registration from Podfile.properties.json, so editing either
486
- // must trip the re-sync as well. Known gap: repointing CODE_SIGN_ENTITLEMENTS
487
- // at a different file is not noticed, because that would mean watching
488
- // project.pbxproj — which RN rewrites during the sync itself.
489
- const watchPaths = [
490
- ...collectWatchPaths([...moduleRoots]),
491
- ...[appTarget.entitlementPath, appTarget.podfilePropertiesPath].filter((p) => p != null),
492
- ];
493
-
494
807
  const scriptPhases = scriptPhasesForModules(modules.map((m) => m.packageName));
495
808
  if (scriptPhases.length > 0) {
496
809
  console.log(
@@ -499,13 +812,15 @@ module.exports = function expoSpmPlugin(context) {
499
812
  }
500
813
 
501
814
  return {
502
- packageDependencies,
503
- productDependencies,
815
+ packageDependencies: summary.packageDependencies,
816
+ productDependencies: summary.productDependencies,
504
817
  generatedSources,
505
818
  flavoredFrameworks,
506
- watchPaths,
819
+ watchPaths: watchPaths(identities, appTarget),
507
820
  scriptPhases,
508
821
  };
509
822
  };
510
823
 
824
+ module.exports.macroPluginFlags = macroPluginFlags;
511
825
  module.exports.resolvePodIdentities = resolvePodIdentities;
826
+ module.exports.uncoveredPod = uncoveredPod;