@react-native-menu/menu 2.2.0 → 2.2.1

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.swift CHANGED
@@ -14,21 +14,26 @@ let reactHeaders: [Target.Dependency] = [
14
14
  // The Swift import shim lives outside ios/. Keep unrelated repository and npm
15
15
  // package contents out of SwiftPM's resource discovery.
16
16
  let usedRootEntries: Set<String> = ["ios", "spm-support", "spm-headers", "Package.swift"]
17
- let unusedRootEntries = try! FileManager.default.contentsOfDirectory(atPath: Context.packageDirectory)
17
+ // `try?` rather than `try!`: a manifest that traps reports a Swift fatal error
18
+ // instead of a SwiftPM diagnostic, which is a miserable thing to debug.
19
+ let unusedRootEntries = ((try? FileManager.default.contentsOfDirectory(atPath: Context.packageDirectory)) ?? [])
18
20
  .filter { !usedRootEntries.contains($0) }
19
21
  .sorted()
20
22
 
21
23
  // Discover sources as folders, splitting the podspec's native and Swift files.
22
24
  // Exclude projects and non-source files from both targets.
23
25
  let iosDirectory = URL(fileURLWithPath: Context.packageDirectory).appendingPathComponent("ios")
24
- let iosEntries = try! FileManager.default.subpathsOfDirectory(atPath: iosDirectory.path)
26
+ let iosEntries = ((try? FileManager.default.subpathsOfDirectory(atPath: iosDirectory.path)) ?? [])
25
27
  .filter { !$0.contains(".xcodeproj/") }
26
28
  func unusedIosEntries(sourceExtensions: Set<String>) -> [String] {
27
29
  iosEntries.filter { entry in
28
30
  let url = iosDirectory.appendingPathComponent(entry)
29
31
  if url.pathExtension == "xcodeproj" { return true }
30
- let isFile = try! url.resourceValues(forKeys: [.isRegularFileKey]).isRegularFile == true
31
- return isFile && (!sourceExtensions.contains(url.pathExtension)
32
+ // An entry that cannot be stat'd -- a dangling symlink, say -- counts as
33
+ // a file so it stays excludable. Excluding a directory would drop
34
+ // everything inside it.
35
+ let isDirectory = (try? url.resourceValues(forKeys: [.isDirectoryKey]))?.isDirectory ?? false
36
+ return !isDirectory && (!sourceExtensions.contains(url.pathExtension)
32
37
  || entry == "Menu-Bridging-Header.h")
33
38
  }
34
39
  .map { "ios/" + $0 }
@@ -63,7 +68,11 @@ let package = Package(
63
68
  // Root the target here so its empty public module stays outside ios/.
64
69
  path: ".",
65
70
  exclude: unusedRootEntries + ["spm-support"] + unusedObjCIosEntries,
66
- sources: ["ios"],
71
+ // Name the source directories rather than all of ios/: a stray .h,
72
+ // .m or .mm anywhere under ios/ (stale codegen output under
73
+ // ios/build/, say, in a consumer using this as a path dependency)
74
+ // would otherwise be compiled into this target.
75
+ sources: ["ios/MenuViewManager.mm", "ios/Shared", "ios/OldArch", "ios/NewArch"],
67
76
  // Required: without it SwiftPM looks for a default include/ folder, which this target does not have.
68
77
  publicHeadersPath: "spm-headers/public",
69
78
  cSettings: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-menu/menu",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "UIMenu component for react-native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -31,6 +31,7 @@
31
31
  "pods": "cd example && pod-install --quiet",
32
32
  "prepare": "bob build",
33
33
  "release": "release-it",
34
+ "spm:check": "node scripts/check-spm.mjs",
34
35
  "start": "react-native start",
35
36
  "test": "jest",
36
37
  "typescript": "tsc --noEmit",
@@ -52,12 +53,12 @@
52
53
  },
53
54
  "homepage": "https://github.com/react-native-menu/menu#readme",
54
55
  "devDependencies": {
55
- "@biomejs/biome": "2.6.7",
56
+ "@biomejs/biome": "2.6.8",
56
57
  "@callstack/react-native-visionos": "^0.79.6",
57
58
  "@react-native-community/cli": "^20.0.2",
58
59
  "@react-native/babel-preset": "^0.81.1",
59
60
  "@react-native/metro-config": "0.81.1",
60
- "@release-it/conventional-changelog": "^11.0.1",
61
+ "@release-it/conventional-changelog": "^12.0.2",
61
62
  "@rnx-kit/metro-config": "^2.1.1",
62
63
  "@types/jest": "^29.1.2",
63
64
  "@types/react": "^19.1.12",
@@ -68,7 +69,7 @@
68
69
  "react-native": "^0.81.1",
69
70
  "react-native-builder-bob": "^0.44.1",
70
71
  "react-native-test-app": "^4.4.9",
71
- "release-it": "^18.1.1",
72
+ "release-it": "^21.1.2",
72
73
  "typescript": "5.9.3"
73
74
  },
74
75
  "peerDependencies": {
@@ -113,7 +114,7 @@
113
114
  "access": "public"
114
115
  },
115
116
  "volta": {
116
- "node": "22.11.0"
117
+ "node": "22.23.5"
117
118
  },
118
119
  "swiftpmConfig": {
119
120
  "name": "react_native_menu"
@@ -21,6 +21,14 @@ __attribute__((objc_runtime_name("_TtP17react_native_menu32FabricViewImplementat
21
21
  @property (nonatomic) UIEdgeInsets hitSlop;
22
22
  @end
23
23
 
24
+ // The superclasses are flattened on purpose: MenuView.mm only ever reaches
25
+ // protocol members and UIKit ones, so mirroring MenuViewImplementation and
26
+ // ActionSheetView here would double the surface that can drift. If MenuView.mm
27
+ // ever needs a member declared on one of those bases, mirror the base class
28
+ // rather than widening the protocol. Availability has to match the Swift
29
+ // declarations, though -- calling an iOS 14 only class outside an availability
30
+ // check does not compile. scripts/check-spm.mjs enforces both halves.
31
+ API_AVAILABLE(ios(14.0))
24
32
  @interface FabricMenuViewImplementation : UIButton <FabricViewImplementationProtocol>
25
33
  @end
26
34
  @interface FabricActionSheetView : UIView <FabricViewImplementationProtocol>