react-native-iap 14.3.2-rc.4 → 14.3.2-rc.6

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.
@@ -1,5 +1,14 @@
1
- import type { ConfigPlugin } from 'expo/config-plugins';
1
+ import type { ExpoConfig } from '@expo/config-types';
2
2
  export declare const modifyProjectBuildGradle: (gradle: string) => string;
3
- declare const _default: ConfigPlugin<void>;
4
- export default _default;
3
+ type IapPluginProps = {
4
+ ios?: {
5
+ 'with-folly-no-couroutines'?: boolean;
6
+ };
7
+ };
8
+ type IapPluginCallable = {
9
+ (config: ExpoConfig): ExpoConfig;
10
+ (config: ExpoConfig, props?: IapPluginProps): ExpoConfig;
11
+ };
12
+ declare const pluginExport: IapPluginCallable;
13
+ export default pluginExport;
5
14
  //# sourceMappingURL=withIAP.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withIAP.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withIAP.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AA0BtD,eAAO,MAAM,wBAAwB,GAAI,QAAQ,MAAM,KAAG,MAWzD,CAAC;;AAiGF,wBAAmE"}
1
+ {"version":3,"file":"withIAP.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withIAP.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AA0BnD,eAAO,MAAM,wBAAwB,GAAI,QAAQ,MAAM,KAAG,MAWzD,CAAC;AAiFF,KAAK,cAAc,GAAG;IACpB,GAAG,CAAC,EAAE;QAGJ,2BAA2B,CAAC,EAAE,OAAO,CAAC;KACvC,CAAC;CACH,CAAC;AAqEF,KAAK,iBAAiB,GAAG;IACvB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC;CAC1D,CAAC;AAOF,QAAA,MAAM,YAAY,EAAE,iBACsC,CAAC;AAE3D,eAAe,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-iap",
3
- "version": "14.3.2-rc.4",
3
+ "version": "14.3.2-rc.6",
4
4
  "description": "React Native In-App Purchases module for iOS and Android using Nitro",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -1,4 +1,13 @@
1
- import type { ConfigPlugin } from 'expo/config-plugins';
1
+ import type { ExpoConfig } from '@expo/config-types';
2
2
  export declare const modifyProjectBuildGradle: (gradle: string) => string;
3
- declare const _default: ConfigPlugin<void>;
4
- export default _default;
3
+ type IapPluginProps = {
4
+ ios?: {
5
+ 'with-folly-no-couroutines'?: boolean;
6
+ };
7
+ };
8
+ type IapPluginCallable = {
9
+ (config: ExpoConfig): ExpoConfig;
10
+ (config: ExpoConfig, props?: IapPluginProps): ExpoConfig;
11
+ };
12
+ declare const pluginExport: IapPluginCallable;
13
+ export default pluginExport;
@@ -83,9 +83,50 @@ const withIapAndroid = (config) => {
83
83
  });
84
84
  return config;
85
85
  };
86
- const withIAP = (config, _props) => {
86
+ const withIapIosFollyWorkaround = (config, props) => {
87
+ const enabled = !!props?.ios?.['with-folly-no-couroutines'];
88
+ if (!enabled)
89
+ return config;
90
+ return (0, config_plugins_1.withPodfile)(config, (config) => {
91
+ let contents = config.modResults.contents;
92
+ // Idempotency: if any of the defines already exists, assume it's applied
93
+ if (contents.includes('FOLLY_CFG_NO_COROUTINES') ||
94
+ contents.includes('FOLLY_HAS_COROUTINES=0')) {
95
+ return config;
96
+ }
97
+ const anchor = 'post_install do |installer|';
98
+ const snippet = `
99
+ # react-native-iap (expo): Disable Folly coroutines to avoid including non-vendored <folly/coro/*> headers
100
+ installer.pods_project.targets.each do |target|
101
+ target.build_configurations.each do |config|
102
+ defs = (config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] || ['$(inherited)'])
103
+ defs << 'FOLLY_NO_CONFIG=1' unless defs.any? { |d| d.to_s.include?('FOLLY_NO_CONFIG') }
104
+ # Portability.h respects FOLLY_CFG_NO_COROUTINES to fully disable coroutine support
105
+ defs << 'FOLLY_CFG_NO_COROUTINES=1' unless defs.any? { |d| d.to_s.include?('FOLLY_CFG_NO_COROUTINES') }
106
+ defs << 'FOLLY_HAS_COROUTINES=0' unless defs.any? { |d| d.to_s.include?('FOLLY_HAS_COROUTINES') }
107
+ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = defs
108
+ end
109
+ end`;
110
+ if (contents.includes(anchor)) {
111
+ contents = contents.replace(anchor, `${anchor}\n${snippet}`);
112
+ }
113
+ else {
114
+ // As a fallback, append a new post_install block
115
+ contents += `
116
+
117
+ ${anchor}
118
+ ${snippet}
119
+ end
120
+ `;
121
+ }
122
+ config.modResults.contents = contents;
123
+ return config;
124
+ });
125
+ };
126
+ const withIAP = (config, props) => {
87
127
  try {
88
- const result = withIapAndroid(config);
128
+ let result = withIapAndroid(config);
129
+ result = withIapIosFollyWorkaround(result, props);
89
130
  // Set flag after first execution to prevent duplicate logs
90
131
  hasLoggedPluginExecution = true;
91
132
  return result;
@@ -96,4 +137,6 @@ const withIAP = (config, _props) => {
96
137
  return config;
97
138
  }
98
139
  };
99
- exports.default = (0, config_plugins_1.createRunOncePlugin)(withIAP, pkg.name, pkg.version);
140
+ const _wrapped = (0, config_plugins_1.createRunOncePlugin)(withIAP, pkg.name, pkg.version);
141
+ const pluginExport = ((config, props) => _wrapped(config, props));
142
+ exports.default = pluginExport;
@@ -3,8 +3,10 @@ import {
3
3
  WarningAggregator,
4
4
  withAndroidManifest,
5
5
  withAppBuildGradle,
6
+ withPodfile,
6
7
  } from 'expo/config-plugins';
7
8
  import type {ConfigPlugin} from 'expo/config-plugins';
9
+ import type {ExpoConfig} from '@expo/config-types';
8
10
 
9
11
  const pkg = require('../../package.json');
10
12
 
@@ -122,9 +124,67 @@ const withIapAndroid: ConfigPlugin = (config) => {
122
124
  return config;
123
125
  };
124
126
 
125
- const withIAP: ConfigPlugin = (config, _props) => {
127
+ type IapPluginProps = {
128
+ ios?: {
129
+ // Intentionally following user-provided key spelling
130
+ // Enable to inject Folly coroutine-disabling macros into Podfile during prebuild
131
+ 'with-folly-no-couroutines'?: boolean;
132
+ };
133
+ };
134
+
135
+ const withIapIosFollyWorkaround: ConfigPlugin<IapPluginProps | undefined> = (
136
+ config,
137
+ props,
138
+ ) => {
139
+ const enabled = !!props?.ios?.['with-folly-no-couroutines'];
140
+ if (!enabled) return config;
141
+
142
+ return withPodfile(config, (config) => {
143
+ let contents = config.modResults.contents;
144
+
145
+ // Idempotency: if any of the defines already exists, assume it's applied
146
+ if (
147
+ contents.includes('FOLLY_CFG_NO_COROUTINES') ||
148
+ contents.includes('FOLLY_HAS_COROUTINES=0')
149
+ ) {
150
+ return config;
151
+ }
152
+
153
+ const anchor = 'post_install do |installer|';
154
+ const snippet = `
155
+ # react-native-iap (expo): Disable Folly coroutines to avoid including non-vendored <folly/coro/*> headers
156
+ installer.pods_project.targets.each do |target|
157
+ target.build_configurations.each do |config|
158
+ defs = (config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] || ['$(inherited)'])
159
+ defs << 'FOLLY_NO_CONFIG=1' unless defs.any? { |d| d.to_s.include?('FOLLY_NO_CONFIG') }
160
+ # Portability.h respects FOLLY_CFG_NO_COROUTINES to fully disable coroutine support
161
+ defs << 'FOLLY_CFG_NO_COROUTINES=1' unless defs.any? { |d| d.to_s.include?('FOLLY_CFG_NO_COROUTINES') }
162
+ defs << 'FOLLY_HAS_COROUTINES=0' unless defs.any? { |d| d.to_s.include?('FOLLY_HAS_COROUTINES') }
163
+ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = defs
164
+ end
165
+ end`;
166
+
167
+ if (contents.includes(anchor)) {
168
+ contents = contents.replace(anchor, `${anchor}\n${snippet}`);
169
+ } else {
170
+ // As a fallback, append a new post_install block
171
+ contents += `
172
+
173
+ ${anchor}
174
+ ${snippet}
175
+ end
176
+ `;
177
+ }
178
+
179
+ config.modResults.contents = contents;
180
+ return config;
181
+ });
182
+ };
183
+
184
+ const withIAP: ConfigPlugin<IapPluginProps | undefined> = (config, props) => {
126
185
  try {
127
- const result = withIapAndroid(config);
186
+ let result = withIapAndroid(config);
187
+ result = withIapIosFollyWorkaround(result, props);
128
188
  // Set flag after first execution to prevent duplicate logs
129
189
  hasLoggedPluginExecution = true;
130
190
  return result;
@@ -138,4 +198,18 @@ const withIAP: ConfigPlugin = (config, _props) => {
138
198
  }
139
199
  };
140
200
 
141
- export default createRunOncePlugin(withIAP, pkg.name, pkg.version);
201
+ // Export a wrapper that is callable with 1 or 2 args (for tests and typical usage)
202
+ type IapPluginCallable = {
203
+ (config: ExpoConfig): ExpoConfig;
204
+ (config: ExpoConfig, props?: IapPluginProps): ExpoConfig;
205
+ };
206
+
207
+ const _wrapped = createRunOncePlugin(withIAP, pkg.name, pkg.version) as unknown as (
208
+ config: ExpoConfig,
209
+ props: IapPluginProps | undefined,
210
+ ) => ExpoConfig;
211
+
212
+ const pluginExport: IapPluginCallable = ((config: ExpoConfig, props?: IapPluginProps) =>
213
+ _wrapped(config, props)) as unknown as IapPluginCallable;
214
+
215
+ export default pluginExport;