react-native-iap 14.3.2-rc.8 → 14.3.2-rc.9
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 {
|
|
1
|
+
import type { ExpoConfig } from '@expo/config-types';
|
|
2
2
|
export declare const modifyProjectBuildGradle: (gradle: string) => string;
|
|
3
|
-
|
|
4
|
-
|
|
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 { pluginExport as default };
|
|
5
14
|
//# sourceMappingURL=withIAP.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withIAP.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withIAP.ts"],"names":[],"mappings":"
|
|
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;AAsEF,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;AASF,QAAA,MAAM,YAAY,EAAE,iBAGyC,CAAC;AAE9D,OAAO,EAAC,YAAY,IAAI,OAAO,EAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ExpoConfig } from '@expo/config-types';
|
|
2
2
|
export declare const modifyProjectBuildGradle: (gradle: string) => string;
|
|
3
|
-
|
|
4
|
-
|
|
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 { pluginExport as default };
|
package/plugin/build/withIAP.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.modifyProjectBuildGradle = void 0;
|
|
3
|
+
exports.default = exports.modifyProjectBuildGradle = void 0;
|
|
4
4
|
const config_plugins_1 = require("expo/config-plugins");
|
|
5
5
|
const pkg = require('../../package.json');
|
|
6
6
|
// Global flag to prevent duplicate logs
|
|
@@ -83,9 +83,50 @@ const withIapAndroid = (config) => {
|
|
|
83
83
|
});
|
|
84
84
|
return config;
|
|
85
85
|
};
|
|
86
|
-
const
|
|
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
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,5 +137,6 @@ const withIAP = (config) => {
|
|
|
96
137
|
return config;
|
|
97
138
|
}
|
|
98
139
|
};
|
|
99
|
-
|
|
100
|
-
|
|
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;
|
package/plugin/src/withIAP.ts
CHANGED
|
@@ -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
|
-
|
|
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
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;
|
|
@@ -139,4 +199,22 @@ const withIAP: ConfigPlugin = (config) => {
|
|
|
139
199
|
};
|
|
140
200
|
|
|
141
201
|
// Standard Expo config plugin export
|
|
142
|
-
|
|
202
|
+
// Export a test-friendly wrapper that accepts 1 or 2 args
|
|
203
|
+
type IapPluginCallable = {
|
|
204
|
+
(config: ExpoConfig): ExpoConfig;
|
|
205
|
+
(config: ExpoConfig, props?: IapPluginProps): ExpoConfig;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const _wrapped = createRunOncePlugin(
|
|
209
|
+
withIAP,
|
|
210
|
+
pkg.name,
|
|
211
|
+
pkg.version,
|
|
212
|
+
) as unknown as (config: ExpoConfig, props: IapPluginProps | undefined) =>
|
|
213
|
+
ExpoConfig;
|
|
214
|
+
|
|
215
|
+
const pluginExport: IapPluginCallable = ((
|
|
216
|
+
config: ExpoConfig,
|
|
217
|
+
props?: IapPluginProps,
|
|
218
|
+
) => _wrapped(config, props)) as unknown as IapPluginCallable;
|
|
219
|
+
|
|
220
|
+
export {pluginExport as default};
|