expo 58.0.1 → 58.0.3
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/android/build.gradle +2 -2
- package/build/winter/runtime.native.js +0 -2
- package/build/winter/runtime.native.js.map +1 -1
- package/bundledNativeModules.json +77 -77
- package/ios/Expo/ExpoReactNativeFactory.swift +2 -2
- package/ios/ExpoObjC/AppDelegates/EXReactRootViewFactory.mm +16 -2
- package/ios/ExpoObjC/include/Expo/EXReactRootViewFactory.h +2 -1
- package/package.json +17 -18
- package/scripts/spm/__tests__/app-target.test.js +105 -1
- package/scripts/spm/__tests__/autolink-gate.test.js +188 -0
- package/scripts/spm/__tests__/classify.test.js +17 -19
- package/scripts/spm/__tests__/diagnostics.test.js +705 -132
- package/scripts/spm/__tests__/manifests.test.js +1086 -75
- package/scripts/spm/__tests__/metadata.test.js +120 -0
- package/scripts/spm/__tests__/plugin.test.js +2549 -346
- package/scripts/spm/app-target.js +44 -1
- package/scripts/spm/autolink-gate.js +40 -0
- package/scripts/spm/classify.js +54 -77
- package/scripts/spm/diagnostics.js +540 -147
- package/scripts/spm/flavored-frameworks.js +80 -125
- package/scripts/spm/manifests.js +523 -205
- package/scripts/spm/metadata.js +152 -0
- package/scripts/spm/plugin.js +592 -277
- package/scripts/spm/podspec.js +56 -19
- package/src/async-require/__tests__/loadBundle.test.ios.ts +2 -2
- package/src/winter/__tests__/{TextDecoderStream.test.ios.ts → TextDecoderStream.test.native.ts} +23 -2
- package/src/winter/runtime.native.ts +0 -2
- package/template.tgz +0 -0
- package/build/winter/TextDecoder.d.ts +0 -13
- package/build/winter/TextDecoder.js +0 -357
- package/build/winter/TextDecoder.js.map +0 -1
- package/src/winter/TextDecoder.ts +0 -427
- package/src/winter/__tests__/TextDecoder.test.native.ts +0 -549
|
@@ -18,6 +18,8 @@ const xcode = require(
|
|
|
18
18
|
require.resolve('xcode', { paths: [path.dirname(require.resolve('@expo/config-plugins'))] })
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
+
const { pluginError } = require('./diagnostics');
|
|
22
|
+
|
|
21
23
|
/** Written by RN's SwiftPM injector into the .xcodeproj it modified. */
|
|
22
24
|
const INJECTION_MARKER = '.spm-injected.json';
|
|
23
25
|
|
|
@@ -205,4 +207,45 @@ function resolveAppTarget(appRoot) {
|
|
|
205
207
|
};
|
|
206
208
|
}
|
|
207
209
|
|
|
208
|
-
|
|
210
|
+
/**
|
|
211
|
+
* Podfile.properties.json. Missing → {}; present but unusable → throw, since every gate would
|
|
212
|
+
* silently fall to its default. This intentionally differs from
|
|
213
|
+
* precompiled_modules.rb#read_podfile_properties and the Podfile template, which both rescue an
|
|
214
|
+
* invalid file to {}.
|
|
215
|
+
*/
|
|
216
|
+
function readPodfileProperties(propertiesPath) {
|
|
217
|
+
if (typeof propertiesPath !== 'string' || propertiesPath.length === 0) return {};
|
|
218
|
+
let properties;
|
|
219
|
+
try {
|
|
220
|
+
properties = JSON.parse(fs.readFileSync(propertiesPath, 'utf8'));
|
|
221
|
+
} catch (error) {
|
|
222
|
+
if (error.code === 'ENOENT') return {};
|
|
223
|
+
throw unusablePropertiesError(propertiesPath, error.message, { cause: error });
|
|
224
|
+
}
|
|
225
|
+
if (properties == null || typeof properties !== 'object' || Array.isArray(properties)) {
|
|
226
|
+
throw unusablePropertiesError(
|
|
227
|
+
propertiesPath,
|
|
228
|
+
`it holds ${describeType(properties)}, not an object`
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
return properties;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Type only: JSON.stringify can overflow on a deep payload. */
|
|
235
|
+
function describeType(payload) {
|
|
236
|
+
if (payload === null) return 'null';
|
|
237
|
+
return Array.isArray(payload) ? 'an array' : `a ${typeof payload}`;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function unusablePropertiesError(propertiesPath, reason, options) {
|
|
241
|
+
return pluginError(
|
|
242
|
+
{
|
|
243
|
+
what: `${propertiesPath} could not be read as Podfile properties (${reason}), so the plugin cannot tell which products this app links.`,
|
|
244
|
+
why: "Carrying on would read every property as unset and leave each gated product to its own default instead of the app's configuration, which only shows up at runtime, so the sync stops here.",
|
|
245
|
+
how: 'Restore the file to a JSON object of properties, then re-run `npx react-native spm update`.',
|
|
246
|
+
},
|
|
247
|
+
options
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
module.exports = { readPodfileProperties, resolveAppTarget };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Port of `companion_autolink_condition_met?`/`_label` (precompiled_modules.rb); its
|
|
3
|
+
* pod_lookup_map is the prebuilt-metadata document here.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* First declared key decides (podName, npmPackage, podfileProperty); none → not met.
|
|
10
|
+
* declaredPodNames = every DECLARED pod, not the ones emitted so far.
|
|
11
|
+
*/
|
|
12
|
+
function autolinkConditionMet(
|
|
13
|
+
condition,
|
|
14
|
+
{ declaredPodNames, autolinkedPackages, podfileProperties } = {}
|
|
15
|
+
) {
|
|
16
|
+
if (condition?.podName != null) return declaredPodNames?.has(condition.podName) === true;
|
|
17
|
+
if (condition?.npmPackage != null) return autolinkedPackages?.has(condition.npmPackage) === true;
|
|
18
|
+
if (condition?.podfileProperty != null) {
|
|
19
|
+
// Opt-out; unset and undeclared both read as nil in Ruby.
|
|
20
|
+
// Keeping them apart would link a product that CocoaPods withholds.
|
|
21
|
+
return (
|
|
22
|
+
(podfileProperties?.[condition.podfileProperty] ?? null) !== (condition.disabledValue ?? null)
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** What to call the condition in a diagnostic: the key that decides it. */
|
|
29
|
+
function autolinkConditionLabel(condition) {
|
|
30
|
+
return condition?.podName ?? condition?.npmPackage ?? condition?.podfileProperty ?? null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Which kind of condition it is: the name of the key that decides it. */
|
|
34
|
+
function autolinkConditionKey(condition) {
|
|
35
|
+
return (
|
|
36
|
+
['podName', 'npmPackage', 'podfileProperty'].find((key) => condition?.[key] != null) ?? null
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = { autolinkConditionKey, autolinkConditionLabel, autolinkConditionMet };
|
package/scripts/spm/classify.js
CHANGED
|
@@ -27,10 +27,6 @@ function appleSourceDir(moduleRoot) {
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
function isIgnoredDir(name) {
|
|
31
|
-
return IGNORED_DIR_RX.test(name);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
30
|
// A direct source-level import of the React/Hermes/jsi families (NOT ExpoModulesCore).
|
|
35
31
|
const REACT_IMPORT_RX =
|
|
36
32
|
/(#import\s*[<"](React|react|ReactCommon|RCTDeprecation|hermes|jsi|cxxreact|jsinspector|jsireact)[/>]|@?import\s+(React|ReactCommon|ReactAppDependencyProvider|hermes|jsi)\b)/;
|
|
@@ -78,53 +74,66 @@ function collectWatchPaths(moduleRoots) {
|
|
|
78
74
|
return watchPaths;
|
|
79
75
|
}
|
|
80
76
|
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Every file under `dir` outside the ignored directories, and those directories
|
|
79
|
+
* relative to `dir`, sorted. An ignored directory is not descended into: SwiftPM
|
|
80
|
+
* rejects an exclude path already covered by an excluded ancestor.
|
|
81
|
+
*/
|
|
82
|
+
function walkSourceTree(dir) {
|
|
83
|
+
const files = [];
|
|
84
|
+
const ignoredDirs = [];
|
|
85
|
+
const visit = (current, prefix) => {
|
|
86
|
+
let entries = [];
|
|
87
|
+
try {
|
|
88
|
+
entries = fs.readdirSync(current, { withFileTypes: true });
|
|
89
|
+
} catch {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
for (const e of entries) {
|
|
93
|
+
const rel = prefix ? `${prefix}/${e.name}` : e.name;
|
|
94
|
+
if (!e.isDirectory()) files.push(path.join(current, e.name));
|
|
95
|
+
else if (IGNORED_DIR_RX.test(e.name)) ignoredDirs.push(rel);
|
|
96
|
+
else visit(path.join(current, e.name), rel);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
visit(dir, '');
|
|
100
|
+
return { files, ignoredDirs: ignoredDirs.sort() };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const REACT_SCANNED_RX = /\.(swift|m|mm|c|h|hpp|cpp|cc)$/;
|
|
104
|
+
const NON_SWIFT_SOURCE_RX = /\.(m|mm|c|cpp|cc)$/;
|
|
105
|
+
|
|
106
|
+
function fileImportsReact(file) {
|
|
83
107
|
try {
|
|
84
|
-
|
|
108
|
+
return textImportsReact(fs.readFileSync(file, 'utf8'));
|
|
85
109
|
} catch {
|
|
86
110
|
return false;
|
|
87
111
|
}
|
|
88
|
-
for (const e of entries) {
|
|
89
|
-
const p = path.join(dir, e.name);
|
|
90
|
-
if (e.isDirectory()) {
|
|
91
|
-
if (isIgnoredDir(e.name)) continue;
|
|
92
|
-
if (sourceTreeImportsReact(p)) return true;
|
|
93
|
-
} else if (/\.(swift|m|mm|c|h|hpp|cpp|cc)$/.test(e.name)) {
|
|
94
|
-
let content = '';
|
|
95
|
-
try {
|
|
96
|
-
content = fs.readFileSync(p, 'utf8');
|
|
97
|
-
} catch {
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
if (textImportsReact(content)) return true;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return false;
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
115
|
+
* What classification needs from a module's Apple sources, from one walk of each
|
|
116
|
+
* source directory. `ignoredDirs` are the ones under the source directory a
|
|
117
|
+
* generated target compiles: it must exclude exactly what classification skipped,
|
|
118
|
+
* or its production library compiles test sources (and their `@testable` imports
|
|
119
|
+
* and mocks). React is looked for in `common/` too, which a module shares across
|
|
120
|
+
* platforms.
|
|
112
121
|
*/
|
|
113
|
-
function
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
function scanAppleSources(moduleRoot) {
|
|
123
|
+
const sourceDir = appleSourceDir(moduleRoot);
|
|
124
|
+
let pureSwift = true;
|
|
125
|
+
let importsReact = false;
|
|
126
|
+
let ignoredDirs = [];
|
|
127
|
+
for (const sub of [...APPLE_SOURCE_DIRS, 'common']) {
|
|
128
|
+
const dir = path.join(moduleRoot, sub);
|
|
129
|
+
const tree = walkSourceTree(dir);
|
|
130
|
+
if (dir === sourceDir) ignoredDirs = tree.ignoredDirs;
|
|
131
|
+
for (const file of tree.files) {
|
|
132
|
+
if (sub !== 'common' && NON_SWIFT_SOURCE_RX.test(file)) pureSwift = false;
|
|
133
|
+
if (!importsReact && REACT_SCANNED_RX.test(file)) importsReact = fileImportsReact(file);
|
|
134
|
+
}
|
|
126
135
|
}
|
|
127
|
-
return
|
|
136
|
+
return { hasSources: sourceDir != null, pureSwift, importsReact, ignoredDirs };
|
|
128
137
|
}
|
|
129
138
|
|
|
130
139
|
/**
|
|
@@ -133,38 +142,8 @@ function collectIgnoredDirs(dir, prefix = '') {
|
|
|
133
142
|
* Modules API does NOT inherit React — only modules whose own source imports the
|
|
134
143
|
* React/Hermes/jsi families (or the core bridge layer itself) do.
|
|
135
144
|
*/
|
|
136
|
-
function moduleNeedsReact(podName,
|
|
137
|
-
|
|
138
|
-
for (const sub of [...APPLE_SOURCE_DIRS, 'common']) {
|
|
139
|
-
const dir = path.join(moduleRoot, sub);
|
|
140
|
-
if (sourceTreeImportsReact(dir)) return true;
|
|
141
|
-
}
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/** Cheap check: a module is pure-Swift if its iOS/apple source has no .m/.mm/.c/.cpp files. */
|
|
146
|
-
function isPureSwift(moduleRoot) {
|
|
147
|
-
const hasNonSwift = (dir) => {
|
|
148
|
-
let entries = [];
|
|
149
|
-
try {
|
|
150
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
151
|
-
} catch {
|
|
152
|
-
return false;
|
|
153
|
-
}
|
|
154
|
-
for (const e of entries) {
|
|
155
|
-
const p = path.join(dir, e.name);
|
|
156
|
-
if (e.isDirectory()) {
|
|
157
|
-
if (isIgnoredDir(e.name)) continue;
|
|
158
|
-
if (hasNonSwift(p)) return true;
|
|
159
|
-
} else if (/\.(m|mm|c|cpp|cc)$/.test(e.name)) {
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return false;
|
|
164
|
-
};
|
|
165
|
-
return APPLE_SOURCE_DIRS.map((s) => path.join(moduleRoot, s))
|
|
166
|
-
.filter((d) => fs.existsSync(d))
|
|
167
|
-
.every((d) => !hasNonSwift(d));
|
|
145
|
+
function moduleNeedsReact(podName, sources) {
|
|
146
|
+
return CORE_REACT_PRODUCTS.has(podName) || sources.importsReact;
|
|
168
147
|
}
|
|
169
148
|
|
|
170
149
|
module.exports = {
|
|
@@ -173,11 +152,9 @@ module.exports = {
|
|
|
173
152
|
REACT_IMPORT_RX,
|
|
174
153
|
appleSourceDir,
|
|
175
154
|
textImportsReact,
|
|
176
|
-
sourceTreeImportsReact,
|
|
177
|
-
collectIgnoredDirs,
|
|
178
155
|
collectWatchPaths,
|
|
179
156
|
documentedPackageRoot,
|
|
180
157
|
findModuleRoot,
|
|
181
158
|
moduleNeedsReact,
|
|
182
|
-
|
|
159
|
+
scanAppleSources,
|
|
183
160
|
};
|