@baeckerherz/expo-mapbox-navigation 0.1.20 → 0.1.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baeckerherz/expo-mapbox-navigation",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "Expo module wrapping Mapbox Navigation SDK v3 for iOS and Android",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -25,14 +25,14 @@ const withMapboxNavigation = (config, { mapboxAccessToken, mapboxSecretToken, na
25
25
  config.ios.infoPlist.NSLocationAlwaysAndWhenInUseUsageDescription =
26
26
  config.ios.infoPlist.NSLocationAlwaysAndWhenInUseUsageDescription ||
27
27
  "This app needs your location for turn-by-turn navigation, including in the background.";
28
- // iOS: Add Mapbox Navigation SPM to the app project for linking + embedding.
29
- // This is the single source of truth for binary xcframework embedding,
30
- // preventing duplicate signatures during archiving.
28
+ // iOS: Add Mapbox Navigation SPM to the app Xcode project. This is the
29
+ // single source of truth for SPM handles resolution, linking, and
30
+ // embedding of all binary xcframeworks. Keeping SPM out of the Pods
31
+ // project avoids duplicate xcframework signatures during archiving.
31
32
  config = (0, withMapboxNavSPM_1.withMapboxNavSPM)(config, { navigationSdkVersion });
32
- // iOS: Add SPM package ref + product deps (without linking) to the Pods
33
- // project so ExpoMapboxNavigation compiles after SPM targets are built.
34
- // Also sets search paths for module visibility.
35
- config = (0, withMapboxNavPodfile_1.withMapboxNavPodfile)(config, { navigationSdkVersion });
33
+ // iOS: Set framework search paths on the ExpoMapboxNavigation pod so it
34
+ // can find SPM-built modules (including PackageFrameworks directory).
35
+ config = (0, withMapboxNavPodfile_1.withMapboxNavPodfile)(config);
36
36
  // Android: Mapbox Maven repository and optional token for SDK download
37
37
  config = (0, withMapboxNavGradle_1.withMapboxNavGradle)(config);
38
38
  config = (0, withMapboxNavGradleProperties_1.withMapboxNavGradleProperties)(config, { mapboxSecretToken });
@@ -1,17 +1,12 @@
1
1
  import { ConfigPlugin } from "@expo/config-plugins";
2
- interface PodfileOptions {
3
- navigationSdkVersion: string;
4
- }
5
2
  /**
6
- * Injects a post_install hook that:
7
- * 1. Adds Mapbox Navigation SDK as an SPM package reference in the Pods project
8
- * with product dependencies on ExpoMapboxNavigation (for build ordering and
9
- * module visibility) but WITHOUT PBXBuildFile entries linking and embedding
10
- * is handled by withMapboxNavSPM in the app project to avoid duplicate
11
- * xcframework signatures during archiving.
12
- * 2. Sets FRAMEWORK_SEARCH_PATHS / SWIFT_INCLUDE_PATHS so the pod can find
13
- * SPM-built frameworks (including transitive deps like MapboxDirections).
14
- * 3. Enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf targets.
3
+ * Patches the Podfile post_install so ExpoMapboxNavigation can find
4
+ * SPM-built Mapbox frameworks (added to the app .xcodeproj by withMapboxNavSPM).
5
+ *
6
+ * Search paths cover all locations where SPM places built modules:
7
+ * - PackageFrameworks (SPM framework products)
8
+ * - BUILT_PRODUCTS_DIR and parent (loose modules and shared products)
9
+ *
10
+ * Also enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf pod targets.
15
11
  */
16
- export declare const withMapboxNavPodfile: ConfigPlugin<PodfileOptions>;
17
- export {};
12
+ export declare const withMapboxNavPodfile: ConfigPlugin;
@@ -37,33 +37,25 @@ exports.withMapboxNavPodfile = void 0;
37
37
  const config_plugins_1 = require("@expo/config-plugins");
38
38
  const fs = __importStar(require("fs"));
39
39
  const path = __importStar(require("path"));
40
- const MAPBOX_NAV_URL = "https://github.com/mapbox/mapbox-navigation-ios.git";
41
- const MAPBOX_NAV_PRODUCTS = [
42
- "MapboxNavigationUIKit",
43
- "MapboxNavigationCore",
44
- ];
45
40
  const PLUGIN_MARKER = "# @baeckerherz/expo-mapbox-navigation:";
46
41
  /**
47
- * Injects a post_install hook that:
48
- * 1. Adds Mapbox Navigation SDK as an SPM package reference in the Pods project
49
- * with product dependencies on ExpoMapboxNavigation (for build ordering and
50
- * module visibility) but WITHOUT PBXBuildFile entries linking and embedding
51
- * is handled by withMapboxNavSPM in the app project to avoid duplicate
52
- * xcframework signatures during archiving.
53
- * 2. Sets FRAMEWORK_SEARCH_PATHS / SWIFT_INCLUDE_PATHS so the pod can find
54
- * SPM-built frameworks (including transitive deps like MapboxDirections).
55
- * 3. Enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf targets.
42
+ * Patches the Podfile post_install so ExpoMapboxNavigation can find
43
+ * SPM-built Mapbox frameworks (added to the app .xcodeproj by withMapboxNavSPM).
44
+ *
45
+ * Search paths cover all locations where SPM places built modules:
46
+ * - PackageFrameworks (SPM framework products)
47
+ * - BUILT_PRODUCTS_DIR and parent (loose modules and shared products)
48
+ *
49
+ * Also enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf pod targets.
56
50
  */
57
- const withMapboxNavPodfile = (config, { navigationSdkVersion }) => {
51
+ const withMapboxNavPodfile = (config) => {
58
52
  return (0, config_plugins_1.withDangerousMod)(config, [
59
53
  "ios",
60
54
  async (config) => {
61
55
  const podfilePath = path.join(config.modRequest.platformProjectRoot, "Podfile");
62
56
  let contents = fs.readFileSync(podfilePath, "utf8");
63
- const versionEscaped = navigationSdkVersion.replace(/'/g, "\\\\'");
64
57
  const hook = `
65
- ${PLUGIN_MARKER} SPM in Pods (deps only) + search paths + BUILD_LIBRARY_FOR_DISTRIBUTION
66
- mapbox_nav_version = '${versionEscaped}'
58
+ ${PLUGIN_MARKER} framework search paths + BUILD_LIBRARY_FOR_DISTRIBUTION
67
59
  installer.pods_project.targets.each do |target|
68
60
  if target.name.start_with?('Mapbox') || target.name == 'Turf'
69
61
  target.build_configurations.each do |cfg|
@@ -72,33 +64,11 @@ const withMapboxNavPodfile = (config, { navigationSdkVersion }) => {
72
64
  end
73
65
  if target.name == 'ExpoMapboxNavigation'
74
66
  target.build_configurations.each do |cfg|
75
- cfg.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= ['$(inherited)']
76
- cfg.build_settings['FRAMEWORK_SEARCH_PATHS'] << '$(BUILT_PRODUCTS_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
77
- cfg.build_settings['FRAMEWORK_SEARCH_PATHS'] << '$(BUILT_PRODUCTS_DIR)/..'
78
- cfg.build_settings['SWIFT_INCLUDE_PATHS'] ||= ['$(inherited)']
79
- cfg.build_settings['SWIFT_INCLUDE_PATHS'] << '$(BUILT_PRODUCTS_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
80
- cfg.build_settings['SWIFT_INCLUDE_PATHS'] << '$(BUILT_PRODUCTS_DIR)/..'
67
+ paths = ['$(inherited)', '$(BUILT_PRODUCTS_DIR)/PackageFrameworks', '$(BUILT_PRODUCTS_DIR)/..', '$(BUILT_PRODUCTS_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)']
68
+ cfg.build_settings['FRAMEWORK_SEARCH_PATHS'] = paths
69
+ cfg.build_settings['SWIFT_INCLUDE_PATHS'] = paths
81
70
  end
82
71
  end
83
- end
84
- emn_target = installer.pods_project.targets.find { |t| t.name == 'ExpoMapboxNavigation' }
85
- if emn_target
86
- project = installer.pods_project
87
- root = project.root_object
88
- pkg_ref = root.package_references&.find { |r| r.respond_to?(:repositoryURL) && r.repositoryURL == '${MAPBOX_NAV_URL}' }
89
- unless pkg_ref
90
- pkg_ref = project.new(Xcodeproj::Project::Object::XCRemoteSwiftPackageReference)
91
- pkg_ref.repositoryURL = '${MAPBOX_NAV_URL}'
92
- pkg_ref.requirement = { 'kind' => 'exactVersion', 'version' => mapbox_nav_version }
93
- root.package_references << pkg_ref
94
- end
95
- ${MAPBOX_NAV_PRODUCTS.map((name) => `
96
- unless emn_target.package_product_dependencies.any? { |d| d.product_name == '${name}' }
97
- dep = project.new(Xcodeproj::Project::Object::XCSwiftPackageProductDependency)
98
- dep.package = pkg_ref
99
- dep.product_name = '${name}'
100
- emn_target.package_product_dependencies << dep
101
- end`).join("")}
102
72
  end`;
103
73
  const escapedMarker = PLUGIN_MARKER.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
104
74
  // Remove any previously injected hook (handles upgrades from older plugin versions)
@@ -44,15 +44,15 @@ const withMapboxNavigation: ConfigPlugin<PluginConfig> = (
44
44
  config.ios.infoPlist.NSLocationAlwaysAndWhenInUseUsageDescription ||
45
45
  "This app needs your location for turn-by-turn navigation, including in the background.";
46
46
 
47
- // iOS: Add Mapbox Navigation SPM to the app project for linking + embedding.
48
- // This is the single source of truth for binary xcframework embedding,
49
- // preventing duplicate signatures during archiving.
47
+ // iOS: Add Mapbox Navigation SPM to the app Xcode project. This is the
48
+ // single source of truth for SPM handles resolution, linking, and
49
+ // embedding of all binary xcframeworks. Keeping SPM out of the Pods
50
+ // project avoids duplicate xcframework signatures during archiving.
50
51
  config = withMapboxNavSPM(config, { navigationSdkVersion });
51
52
 
52
- // iOS: Add SPM package ref + product deps (without linking) to the Pods
53
- // project so ExpoMapboxNavigation compiles after SPM targets are built.
54
- // Also sets search paths for module visibility.
55
- config = withMapboxNavPodfile(config, { navigationSdkVersion });
53
+ // iOS: Set framework search paths on the ExpoMapboxNavigation pod so it
54
+ // can find SPM-built modules (including PackageFrameworks directory).
55
+ config = withMapboxNavPodfile(config);
56
56
 
57
57
  // Android: Mapbox Maven repository and optional token for SDK download
58
58
  config = withMapboxNavGradle(config);
@@ -2,33 +2,19 @@ import { withDangerousMod, ConfigPlugin } from "@expo/config-plugins";
2
2
  import * as fs from "fs";
3
3
  import * as path from "path";
4
4
 
5
- const MAPBOX_NAV_URL = "https://github.com/mapbox/mapbox-navigation-ios.git";
6
- const MAPBOX_NAV_PRODUCTS = [
7
- "MapboxNavigationUIKit",
8
- "MapboxNavigationCore",
9
- ];
10
-
11
5
  const PLUGIN_MARKER = "# @baeckerherz/expo-mapbox-navigation:";
12
6
 
13
- interface PodfileOptions {
14
- navigationSdkVersion: string;
15
- }
16
-
17
7
  /**
18
- * Injects a post_install hook that:
19
- * 1. Adds Mapbox Navigation SDK as an SPM package reference in the Pods project
20
- * with product dependencies on ExpoMapboxNavigation (for build ordering and
21
- * module visibility) but WITHOUT PBXBuildFile entries linking and embedding
22
- * is handled by withMapboxNavSPM in the app project to avoid duplicate
23
- * xcframework signatures during archiving.
24
- * 2. Sets FRAMEWORK_SEARCH_PATHS / SWIFT_INCLUDE_PATHS so the pod can find
25
- * SPM-built frameworks (including transitive deps like MapboxDirections).
26
- * 3. Enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf targets.
8
+ * Patches the Podfile post_install so ExpoMapboxNavigation can find
9
+ * SPM-built Mapbox frameworks (added to the app .xcodeproj by withMapboxNavSPM).
10
+ *
11
+ * Search paths cover all locations where SPM places built modules:
12
+ * - PackageFrameworks (SPM framework products)
13
+ * - BUILT_PRODUCTS_DIR and parent (loose modules and shared products)
14
+ *
15
+ * Also enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf pod targets.
27
16
  */
28
- export const withMapboxNavPodfile: ConfigPlugin<PodfileOptions> = (
29
- config,
30
- { navigationSdkVersion }
31
- ) => {
17
+ export const withMapboxNavPodfile: ConfigPlugin = (config) => {
32
18
  return withDangerousMod(config, [
33
19
  "ios",
34
20
  async (config) => {
@@ -38,11 +24,8 @@ export const withMapboxNavPodfile: ConfigPlugin<PodfileOptions> = (
38
24
  );
39
25
  let contents = fs.readFileSync(podfilePath, "utf8");
40
26
 
41
- const versionEscaped = navigationSdkVersion.replace(/'/g, "\\\\'");
42
-
43
27
  const hook = `
44
- ${PLUGIN_MARKER} SPM in Pods (deps only) + search paths + BUILD_LIBRARY_FOR_DISTRIBUTION
45
- mapbox_nav_version = '${versionEscaped}'
28
+ ${PLUGIN_MARKER} framework search paths + BUILD_LIBRARY_FOR_DISTRIBUTION
46
29
  installer.pods_project.targets.each do |target|
47
30
  if target.name.start_with?('Mapbox') || target.name == 'Turf'
48
31
  target.build_configurations.each do |cfg|
@@ -51,35 +34,11 @@ export const withMapboxNavPodfile: ConfigPlugin<PodfileOptions> = (
51
34
  end
52
35
  if target.name == 'ExpoMapboxNavigation'
53
36
  target.build_configurations.each do |cfg|
54
- cfg.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= ['$(inherited)']
55
- cfg.build_settings['FRAMEWORK_SEARCH_PATHS'] << '$(BUILT_PRODUCTS_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
56
- cfg.build_settings['FRAMEWORK_SEARCH_PATHS'] << '$(BUILT_PRODUCTS_DIR)/..'
57
- cfg.build_settings['SWIFT_INCLUDE_PATHS'] ||= ['$(inherited)']
58
- cfg.build_settings['SWIFT_INCLUDE_PATHS'] << '$(BUILT_PRODUCTS_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
59
- cfg.build_settings['SWIFT_INCLUDE_PATHS'] << '$(BUILT_PRODUCTS_DIR)/..'
37
+ paths = ['$(inherited)', '$(BUILT_PRODUCTS_DIR)/PackageFrameworks', '$(BUILT_PRODUCTS_DIR)/..', '$(BUILT_PRODUCTS_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)']
38
+ cfg.build_settings['FRAMEWORK_SEARCH_PATHS'] = paths
39
+ cfg.build_settings['SWIFT_INCLUDE_PATHS'] = paths
60
40
  end
61
41
  end
62
- end
63
- emn_target = installer.pods_project.targets.find { |t| t.name == 'ExpoMapboxNavigation' }
64
- if emn_target
65
- project = installer.pods_project
66
- root = project.root_object
67
- pkg_ref = root.package_references&.find { |r| r.respond_to?(:repositoryURL) && r.repositoryURL == '${MAPBOX_NAV_URL}' }
68
- unless pkg_ref
69
- pkg_ref = project.new(Xcodeproj::Project::Object::XCRemoteSwiftPackageReference)
70
- pkg_ref.repositoryURL = '${MAPBOX_NAV_URL}'
71
- pkg_ref.requirement = { 'kind' => 'exactVersion', 'version' => mapbox_nav_version }
72
- root.package_references << pkg_ref
73
- end
74
- ${MAPBOX_NAV_PRODUCTS.map(
75
- (name) => `
76
- unless emn_target.package_product_dependencies.any? { |d| d.product_name == '${name}' }
77
- dep = project.new(Xcodeproj::Project::Object::XCSwiftPackageProductDependency)
78
- dep.package = pkg_ref
79
- dep.product_name = '${name}'
80
- emn_target.package_product_dependencies << dep
81
- end`
82
- ).join("")}
83
42
  end`;
84
43
 
85
44
  const escapedMarker = PLUGIN_MARKER.replace(