react-native-webrtc-kaleidoscope 2.7.6 → 2.7.7

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": "react-native-webrtc-kaleidoscope",
3
- "version": "2.7.6",
3
+ "version": "2.7.7",
4
4
  "description": "Live video effects (blur, background replacement, generative backgrounds, flip/rotate) for react-native-webrtc, packaged as a managed-Expo-friendly Expo Module. Working on web, Android, and iOS. Active development.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -16,10 +16,14 @@ exports.bumpDeploymentTarget = bumpDeploymentTarget;
16
16
  const node_fs_1 = __importDefault(require('node:fs'));
17
17
  const node_path_1 = __importDefault(require('node:path'));
18
18
  const constants_1 = require('../lib/constants');
19
- // Mirrors ios/Kaleidoscope.podspec :ios => '15.0'. Bumping the podspec requires
20
- // bumping this constant; the drift cost is a silent pod-install drop (the bug
21
- // this plugin fixes): expo-modules-autolinking drops any pod whose declared
22
- // minimum platform exceeds the Podfile platform.
19
+ // The Kaleidoscope POD's own iOS floor; mirrors ios/Kaleidoscope.podspec
20
+ // :ios => '15.0'. Bumping the podspec requires bumping this constant. It is
21
+ // reconciled against the HOST RN's floor at write time (see bumpDeploymentTarget):
22
+ // the pod floor is only forced when it EXCEEDS the floor the generated Podfile
23
+ // already defaults to, because expo-modules-autolinking drops any pod whose
24
+ // declared minimum platform exceeds the Podfile platform. It is never written
25
+ // BELOW the Podfile's own default, which would lower RN's floor and fail pod
26
+ // install on RN's core pods (issue #86: RN >= 0.81's floor 15.1 exceeds this).
23
27
  const IOS_DEPLOYMENT_TARGET = '15.0';
24
28
  /**
25
29
  * Compare two dotted version strings element-wise. Returns true iff `existing`
@@ -42,15 +46,62 @@ function isVersionLessThan(existing, target) {
42
46
  return false; // equal
43
47
  }
44
48
  /**
45
- * Raise `ios.deploymentTarget` in Podfile.properties.json to the library
46
- * minimum. The generated Podfile reads `podfile_properties['ios.deploymentTarget']`
47
- * at the top, so this is the canonical, no-Podfile-edit override seam. Without
48
- * this bump the Kaleidoscope pod is silently dropped and the runtime module
49
- * lookup throws. Non-downgrading, idempotent, non-fatal (warn, never throw).
49
+ * The iOS deployment-target FLOOR the generated Podfile falls back to when
50
+ * `ios.deploymentTarget` is unset. Expo/RN prebuild bakes the host RN's own floor
51
+ * (`min_ios_version_supported`) into the Podfile's platform line as a literal,
52
+ * e.g. `platform :ios, podfile_properties['ios.deploymentTarget'] || '15.1'` (or a
53
+ * bare `platform :ios, '15.1'`). That literal is exactly the value the Podfile
54
+ * uses when we leave the props key alone, so it is the floor we must not drop
55
+ * below. Returns the dotted version, or undefined if the Podfile is absent,
56
+ * unreadable, or states its fallback as a non-literal (a Ruby call) we cannot read
57
+ * statically; the caller then conservatively forces the pod floor (prior behavior).
50
58
  *
51
- * Reads the file by hand (not readTextOrNull) because it must DISTINGUISH a
52
- * missing file (treat as `{}` and write the bump) from an unreadable one (bail
53
- * without clobbering); a distinction readTextOrNull deliberately flattens.
59
+ * The Podfile, already on disk at mod-execution time, is preferred over reaching
60
+ * into react-native's Ruby helper: no dependency to resolve, no coupling to RN's
61
+ * internal file layout or `exports` map, and it reflects any consumer Podfile
62
+ * override too.
63
+ */
64
+ function readPodfileIosFloor(platformProjectRoot) {
65
+ try {
66
+ const podfile = node_fs_1.default.readFileSync(
67
+ node_path_1.default.join(platformProjectRoot, 'Podfile'),
68
+ 'utf8',
69
+ );
70
+ const platformLine = podfile.match(/^[ \t]*platform[ \t]+:ios\b.*$/m)?.[0];
71
+ if (!platformLine) return undefined;
72
+ // The only dotted-numeric quoted token on the platform line is the floor
73
+ // literal; `'ios.deploymentTarget'` is non-numeric. Take the last match so a
74
+ // bare `platform :ios, 'X.Y'` and the `|| 'X.Y'` fallback form both resolve.
75
+ const versions = platformLine.match(/['"]\d+\.\d+(?:\.\d+)?['"]/g);
76
+ const last = versions?.[versions.length - 1];
77
+ return last ? last.replace(/['"]/g, '') : undefined;
78
+ } catch {
79
+ return undefined;
80
+ }
81
+ }
82
+ /**
83
+ * Reconcile `ios.deploymentTarget` in Podfile.properties.json so the Kaleidoscope
84
+ * pod is not dropped by expo-modules-autolinking (which drops any pod whose
85
+ * declared minimum platform exceeds the Podfile platform), WITHOUT ever lowering
86
+ * the host RN's own floor. The generated Podfile reads
87
+ * `podfile_properties['ios.deploymentTarget']` at the top, so this props key is the
88
+ * canonical, no-Podfile-edit override seam.
89
+ *
90
+ * Given the pod floor (IOS_DEPLOYMENT_TARGET) and the Podfile's own fallback floor
91
+ * (readPodfileIosFloor, i.e. the host RN's floor):
92
+ * - key set >= pod floor: leave it (never downgrade).
93
+ * - key set < pod floor: raise it to the pod floor.
94
+ * - key unset, Podfile floor already >= pod floor: DEFER (leave unset). The
95
+ * Podfile's `|| <floor>` already satisfies the pod, so writing the lower pod
96
+ * floor would clobber it and break pod install on RN's core pods (issue #86).
97
+ * Deferring also auto-tracks future RN floor bumps with no code change.
98
+ * - key unset, Podfile floor below or unknown: force the pod floor (prior
99
+ * behavior, e.g. RN 0.74's 13.4 < 15.0).
100
+ * Idempotent, non-fatal (warn, never throw).
101
+ *
102
+ * Reads the props file by hand (not readTextOrNull) because it must DISTINGUISH a
103
+ * missing file (treat as `{}`) from an unreadable one (bail without clobbering);
104
+ * a distinction readTextOrNull deliberately flattens.
54
105
  */
55
106
  function bumpDeploymentTarget(platformProjectRoot) {
56
107
  const propsPath = node_path_1.default.join(platformProjectRoot, 'Podfile.properties.json');
@@ -90,10 +141,20 @@ function bumpDeploymentTarget(platformProjectRoot) {
90
141
  for (const key of Object.keys(parsed)) {
91
142
  next[key] = parsed[key];
92
143
  }
93
- const existing = next['ios.deploymentTarget'];
94
- if (
95
- isVersionLessThan(typeof existing === 'string' ? existing : undefined, IOS_DEPLOYMENT_TARGET)
96
- ) {
144
+ const existingRaw = next['ios.deploymentTarget'];
145
+ const existing = typeof existingRaw === 'string' ? existingRaw : undefined;
146
+ if (existing === undefined) {
147
+ // Unset: the Podfile resolves `|| <floor literal>`, which tracks the host
148
+ // RN's own iOS floor. Only force the pod floor when that fallback floor is
149
+ // below it (or unreadable); otherwise defer so we never lower RN's floor.
150
+ // `isVersionLessThan(undefined, ...)` is true, so an unreadable Podfile floor
151
+ // falls back to forcing the pod floor (prior behavior).
152
+ const podfileFloor = readPodfileIosFloor(platformProjectRoot);
153
+ if (isVersionLessThan(podfileFloor, IOS_DEPLOYMENT_TARGET)) {
154
+ next['ios.deploymentTarget'] = IOS_DEPLOYMENT_TARGET;
155
+ }
156
+ } else if (isVersionLessThan(existing, IOS_DEPLOYMENT_TARGET)) {
157
+ // Explicit value below the pod floor: raise it. At or above: leave it.
97
158
  next['ios.deploymentTarget'] = IOS_DEPLOYMENT_TARGET;
98
159
  }
99
160
  node_fs_1.default.writeFileSync(propsPath, `${JSON.stringify(next, null, 2)}\n`);