@jacques_gordon/expo-mapbox-navigation 2.2.14 → 2.2.16

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.
package/app.plugin.js CHANGED
@@ -159,7 +159,16 @@ const withMapboxNavigation = (config, options = {}) => {
159
159
 
160
160
  console.log(`[@jacques_gordon/expo-mapbox-navigation] Maps ${mapsVersion} (minor=${mapsMinor}) → Navigation ${navMin}..<3.${navMinor+1}.0`);
161
161
  console.log(`[@jacques_gordon/expo-mapbox-navigation] Phase: ${mapsMinor <= 15 ? `1 (offset -3: ${mapsMinor}-3=${navMinor})` : `2 (aligned: ${navMinor})`}`);
162
+
163
+ // IMPORTANT: spmHook below is a JS template literal. Any dollar-brace
164
+ // interpolation syntax written directly inside it is evaluated as JS,
165
+ // NOT left as text for Ruby. Ruby build-setting variables that must
166
+ // survive into the generated Podfile (e.g. PODS_CONFIGURATION_BUILD_DIR)
167
+ // are built here as plain JS strings and interpolated via a named
168
+ // variable, so the literal dollar-brace text reaches the Ruby side
169
+ // untouched instead of being evaluated as a JS expression.
162
170
  const podsBuildDir = '$' + '{PODS_CONFIGURATION_BUILD_DIR}';
171
+
163
172
  // The Ruby hook — identical pattern to @rnmapbox/maps _add_spm_to_target
164
173
  const spmHook = `
165
174
  # [ExpoMapboxNavigation] SPM hook — injected by @jacques_gordon/expo-mapbox-navigation
@@ -170,6 +179,26 @@ def _expo_mapbox_nav_add_spm(installer)
170
179
  requirement = { kind: 'upToNextMinorVersion', minimumVersion: '${navMin}' }
171
180
  products = ['MapboxNavigationCore', 'MapboxNavigationUIKit']
172
181
 
182
+ # MapboxNavigationCore links against MapboxNavigationNative (a separate
183
+ # remote SPM package: mapbox-navigation-native-ios), which ships the
184
+ # precompiled binary defining native ObjC classes (e.g. MBNNAmenity).
185
+ # Without adding it explicitly as a product dependency on our own pod
186
+ # target, MapboxNavigationCore.swift compiles fine (headers are visible
187
+ # via the resolved workspace package graph) but the app fails to LINK,
188
+ # with "Undefined symbols ... _OBJC_CLASS_$_MBNNAmenity", because the
189
+ # xcframework binary itself was never added to any target's link phase.
190
+ native_url = 'https://github.com/mapbox/mapbox-navigation-native-ios.git'
191
+ # NOTE: MapboxNavigationNative's "major" version is really just an
192
+ # incrementing build counter (has been 124, 206, 310, 324... over time),
193
+ # not semantic versioning. A narrow upToNextMajorVersion window would
194
+ # exclude whatever version mapbox-navigation-ios actually resolves to
195
+ # internally, causing SPM dependency resolution to fail outright. We use
196
+ # a deliberately wide range instead — the real version lock already comes
197
+ # from mapbox-navigation-ios's own Package.swift; this reference only
198
+ # needs to expose the product, not add a second constraint.
199
+ native_requirement = { kind: 'range', minimumVersion: '1.0.0', maximumVersion: '9999.0.0' }
200
+ native_product = 'MapboxNavigationNative'
201
+
173
202
  pkg_class = Xcodeproj::Project::Object::XCRemoteSwiftPackageReference
174
203
  ref_class = Xcodeproj::Project::Object::XCSwiftPackageProductDependency
175
204
  dep_class = Xcodeproj::Project::Object::PBXTargetDependency
@@ -188,6 +217,21 @@ def _expo_mapbox_nav_add_spm(installer)
188
217
  puts '[ExpoMapboxNavigation] Added mapbox-navigation-ios to pods_project'
189
218
  end
190
219
 
220
+ # ── Step 1a: Register mapbox-navigation-native-ios as its own package ─────
221
+ # This is a SEPARATE remote repo from mapbox-navigation-ios, so it needs
222
+ # its own XCRemoteSwiftPackageReference — it cannot be listed as a
223
+ # product of the main package reference above.
224
+ native_pkg = pods_project.root_object.package_references.find { |p|
225
+ p.class == pkg_class && p.repositoryURL == native_url
226
+ }
227
+ unless native_pkg
228
+ native_pkg = pods_project.new(pkg_class)
229
+ native_pkg.repositoryURL = native_url
230
+ native_pkg.requirement = native_requirement
231
+ pods_project.root_object.package_references << native_pkg
232
+ puts '[ExpoMapboxNavigation] Added mapbox-navigation-native-ios to pods_project'
233
+ end
234
+
191
235
  expo_target = pods_project.targets.find { |t| t.name == 'ExpoMapboxNavigation' }
192
236
  expo_target ||= pods_project.targets.find { |t| t.name.include?('ExpoMapboxNavigation') }
193
237
  if expo_target
@@ -206,8 +250,21 @@ def _expo_mapbox_nav_add_spm(installer)
206
250
  end
207
251
  end
208
252
 
253
+ # 1b. MapboxNavigationNative product dependency (fixes MBNNAmenity
254
+ # and other native symbols being undefined at final app link)
255
+ native_prod_ref = expo_target.package_product_dependencies.find { |r|
256
+ r.class == ref_class && r.package == native_pkg && r.product_name == native_product
257
+ }
258
+ unless native_prod_ref
259
+ native_prod_ref = pods_project.new(ref_class)
260
+ native_prod_ref.package = native_pkg
261
+ native_prod_ref.product_name = native_product
262
+ expo_target.package_product_dependencies << native_prod_ref
263
+ puts "[ExpoMapboxNavigation] Added package_product_dependency: #{native_product}"
264
+ end
265
+
209
266
  # ── SWIFT_INCLUDE_PATHS fix ──────────────────────────────────────────────
210
- # SPM compiles .swiftmodule into ${PODS_CONFIGURATION_BUILD_DIR}.
267
+ # SPM compiles .swiftmodule into PODS_CONFIGURATION_BUILD_DIR.
211
268
  # Without adding this path, Xcode throws "no such module MapboxNavigationCore".
212
269
  # Source: https://trinhngocthuyen.com/posts/tech/spm-with-cocoapods/
213
270
  expo_target.build_configurations.each do |config|
@@ -244,6 +301,18 @@ def _expo_mapbox_nav_add_spm(installer)
244
301
  user_project.root_object.package_references << user_pkg
245
302
  puts "[ExpoMapboxNavigation] Registered package ref in #{user_project.path.basename}"
246
303
  end
304
+
305
+ user_native_pkg = user_project.root_object.package_references.find { |p|
306
+ p.class == pkg_class && p.repositoryURL == native_url
307
+ }
308
+ unless user_native_pkg
309
+ user_native_pkg = user_project.new(pkg_class)
310
+ user_native_pkg.repositoryURL = native_url
311
+ user_native_pkg.requirement = native_requirement
312
+ user_project.root_object.package_references << user_native_pkg
313
+ puts "[ExpoMapboxNavigation] Registered native package ref in #{user_project.path.basename}"
314
+ end
315
+
247
316
  user_project.save
248
317
  end
249
318
  end
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jacques_gordon/expo-mapbox-navigation",
3
- "version": "2.2.14",
3
+ "version": "2.2.16",
4
4
  "description": "Expo module for Mapbox Navigation SDK with 16KB page size support, NDK27, and Mapbox Maps v11.11.0+",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  "clean": "rm -rf build",
10
10
  "lint": "tsc --noEmit",
11
11
  "test": "echo \"Tests require a full Expo project with EAS Build. See README.\"",
12
- "prepublishOnly": ""
12
+ "prepublishOnly": "npm run build"
13
13
  },
14
14
  "keywords": [
15
15
  "expo",
@@ -159,7 +159,16 @@ const withMapboxNavigation = (config, options = {}) => {
159
159
 
160
160
  console.log(`[@jacques_gordon/expo-mapbox-navigation] Maps ${mapsVersion} (minor=${mapsMinor}) → Navigation ${navMin}..<3.${navMinor+1}.0`);
161
161
  console.log(`[@jacques_gordon/expo-mapbox-navigation] Phase: ${mapsMinor <= 15 ? `1 (offset -3: ${mapsMinor}-3=${navMinor})` : `2 (aligned: ${navMinor})`}`);
162
+
163
+ // IMPORTANT: spmHook below is a JS template literal. Any dollar-brace
164
+ // interpolation syntax written directly inside it is evaluated as JS,
165
+ // NOT left as text for Ruby. Ruby build-setting variables that must
166
+ // survive into the generated Podfile (e.g. PODS_CONFIGURATION_BUILD_DIR)
167
+ // are built here as plain JS strings and interpolated via a named
168
+ // variable, so the literal dollar-brace text reaches the Ruby side
169
+ // untouched instead of being evaluated as a JS expression.
162
170
  const podsBuildDir = '$' + '{PODS_CONFIGURATION_BUILD_DIR}';
171
+
163
172
  // The Ruby hook — identical pattern to @rnmapbox/maps _add_spm_to_target
164
173
  const spmHook = `
165
174
  # [ExpoMapboxNavigation] SPM hook — injected by @jacques_gordon/expo-mapbox-navigation
@@ -170,6 +179,26 @@ def _expo_mapbox_nav_add_spm(installer)
170
179
  requirement = { kind: 'upToNextMinorVersion', minimumVersion: '${navMin}' }
171
180
  products = ['MapboxNavigationCore', 'MapboxNavigationUIKit']
172
181
 
182
+ # MapboxNavigationCore links against MapboxNavigationNative (a separate
183
+ # remote SPM package: mapbox-navigation-native-ios), which ships the
184
+ # precompiled binary defining native ObjC classes (e.g. MBNNAmenity).
185
+ # Without adding it explicitly as a product dependency on our own pod
186
+ # target, MapboxNavigationCore.swift compiles fine (headers are visible
187
+ # via the resolved workspace package graph) but the app fails to LINK,
188
+ # with "Undefined symbols ... _OBJC_CLASS_$_MBNNAmenity", because the
189
+ # xcframework binary itself was never added to any target's link phase.
190
+ native_url = 'https://github.com/mapbox/mapbox-navigation-native-ios.git'
191
+ # NOTE: MapboxNavigationNative's "major" version is really just an
192
+ # incrementing build counter (has been 124, 206, 310, 324... over time),
193
+ # not semantic versioning. A narrow upToNextMajorVersion window would
194
+ # exclude whatever version mapbox-navigation-ios actually resolves to
195
+ # internally, causing SPM dependency resolution to fail outright. We use
196
+ # a deliberately wide range instead — the real version lock already comes
197
+ # from mapbox-navigation-ios's own Package.swift; this reference only
198
+ # needs to expose the product, not add a second constraint.
199
+ native_requirement = { kind: 'range', minimumVersion: '1.0.0', maximumVersion: '9999.0.0' }
200
+ native_product = 'MapboxNavigationNative'
201
+
173
202
  pkg_class = Xcodeproj::Project::Object::XCRemoteSwiftPackageReference
174
203
  ref_class = Xcodeproj::Project::Object::XCSwiftPackageProductDependency
175
204
  dep_class = Xcodeproj::Project::Object::PBXTargetDependency
@@ -188,6 +217,21 @@ def _expo_mapbox_nav_add_spm(installer)
188
217
  puts '[ExpoMapboxNavigation] Added mapbox-navigation-ios to pods_project'
189
218
  end
190
219
 
220
+ # ── Step 1a: Register mapbox-navigation-native-ios as its own package ─────
221
+ # This is a SEPARATE remote repo from mapbox-navigation-ios, so it needs
222
+ # its own XCRemoteSwiftPackageReference — it cannot be listed as a
223
+ # product of the main package reference above.
224
+ native_pkg = pods_project.root_object.package_references.find { |p|
225
+ p.class == pkg_class && p.repositoryURL == native_url
226
+ }
227
+ unless native_pkg
228
+ native_pkg = pods_project.new(pkg_class)
229
+ native_pkg.repositoryURL = native_url
230
+ native_pkg.requirement = native_requirement
231
+ pods_project.root_object.package_references << native_pkg
232
+ puts '[ExpoMapboxNavigation] Added mapbox-navigation-native-ios to pods_project'
233
+ end
234
+
191
235
  expo_target = pods_project.targets.find { |t| t.name == 'ExpoMapboxNavigation' }
192
236
  expo_target ||= pods_project.targets.find { |t| t.name.include?('ExpoMapboxNavigation') }
193
237
  if expo_target
@@ -206,8 +250,21 @@ def _expo_mapbox_nav_add_spm(installer)
206
250
  end
207
251
  end
208
252
 
253
+ # 1b. MapboxNavigationNative product dependency (fixes MBNNAmenity
254
+ # and other native symbols being undefined at final app link)
255
+ native_prod_ref = expo_target.package_product_dependencies.find { |r|
256
+ r.class == ref_class && r.package == native_pkg && r.product_name == native_product
257
+ }
258
+ unless native_prod_ref
259
+ native_prod_ref = pods_project.new(ref_class)
260
+ native_prod_ref.package = native_pkg
261
+ native_prod_ref.product_name = native_product
262
+ expo_target.package_product_dependencies << native_prod_ref
263
+ puts "[ExpoMapboxNavigation] Added package_product_dependency: #{native_product}"
264
+ end
265
+
209
266
  # ── SWIFT_INCLUDE_PATHS fix ──────────────────────────────────────────────
210
- # SPM compiles .swiftmodule into ${PODS_CONFIGURATION_BUILD_DIR}.
267
+ # SPM compiles .swiftmodule into PODS_CONFIGURATION_BUILD_DIR.
211
268
  # Without adding this path, Xcode throws "no such module MapboxNavigationCore".
212
269
  # Source: https://trinhngocthuyen.com/posts/tech/spm-with-cocoapods/
213
270
  expo_target.build_configurations.each do |config|
@@ -244,6 +301,18 @@ def _expo_mapbox_nav_add_spm(installer)
244
301
  user_project.root_object.package_references << user_pkg
245
302
  puts "[ExpoMapboxNavigation] Registered package ref in #{user_project.path.basename}"
246
303
  end
304
+
305
+ user_native_pkg = user_project.root_object.package_references.find { |p|
306
+ p.class == pkg_class && p.repositoryURL == native_url
307
+ }
308
+ unless user_native_pkg
309
+ user_native_pkg = user_project.new(pkg_class)
310
+ user_native_pkg.repositoryURL = native_url
311
+ user_native_pkg.requirement = native_requirement
312
+ user_project.root_object.package_references << user_native_pkg
313
+ puts "[ExpoMapboxNavigation] Registered native package ref in #{user_project.path.basename}"
314
+ end
315
+
247
316
  user_project.save
248
317
  end
249
318
  end
File without changes
@@ -1,2 +0,0 @@
1
- #Wed Jul 01 20:44:58 CEST 2026
2
- gradle.version=8.9
File without changes