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
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
autolinkConditionKey,
|
|
5
|
+
autolinkConditionLabel,
|
|
6
|
+
autolinkConditionMet,
|
|
7
|
+
} = require('../autolink-gate');
|
|
8
|
+
|
|
9
|
+
/** expo-camera's barcode scanner, the only gated product shipping today. */
|
|
10
|
+
const BARCODE_SCANNER = {
|
|
11
|
+
podfileProperty: 'expo.camera.barcode-scanner-enabled',
|
|
12
|
+
disabledValue: 'false',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const met = (condition, options) => autolinkConditionMet(condition, options);
|
|
16
|
+
|
|
17
|
+
describe('a condition on a sibling pod', () => {
|
|
18
|
+
const condition = { podName: 'ExpoCamera' };
|
|
19
|
+
|
|
20
|
+
it('is met when the install declares that pod', () => {
|
|
21
|
+
expect(met(condition, { declaredPodNames: new Set(['ExpoModulesCore', 'ExpoCamera']) })).toBe(
|
|
22
|
+
true
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('is not met when nothing declares it', () => {
|
|
27
|
+
expect(met(condition, { declaredPodNames: new Set(['ExpoModulesCore']) })).toBe(false);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Declared, not linked: a pod the install declares but cannot build still
|
|
31
|
+
// decides the gate, exactly as CocoaPods' registry of declared products does.
|
|
32
|
+
// Reading a set of already-linked pods instead would make the answer depend on
|
|
33
|
+
// how far the emit loop had got.
|
|
34
|
+
it('is not met when the caller passes no declared pods', () => {
|
|
35
|
+
expect(met(condition)).toBe(false);
|
|
36
|
+
expect(met(condition, {})).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('a condition on an npm package', () => {
|
|
41
|
+
const condition = { npmPackage: 'expo-camera' };
|
|
42
|
+
|
|
43
|
+
it('is met when the app autolinks that package', () => {
|
|
44
|
+
expect(met(condition, { autolinkedPackages: new Set(['expo', 'expo-camera']) })).toBe(true);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('is not met when it does not', () => {
|
|
48
|
+
expect(met(condition, { autolinkedPackages: new Set(['expo']) })).toBe(false);
|
|
49
|
+
expect(met(condition)).toBe(false);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('a condition on a Podfile property', () => {
|
|
54
|
+
// Opt-out, not opt-in: the product links unless the app turned it off. Reading
|
|
55
|
+
// this the other way round drops a module from every app that never set it.
|
|
56
|
+
it('is met when the app declares no such property', () => {
|
|
57
|
+
expect(met(BARCODE_SCANNER, { podfileProperties: { 'expo.jsEngine': 'hermes' } })).toBe(true);
|
|
58
|
+
expect(met(BARCODE_SCANNER, { podfileProperties: {} })).toBe(true);
|
|
59
|
+
expect(met(BARCODE_SCANNER)).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('is not met when the property holds the disabled value', () => {
|
|
63
|
+
expect(
|
|
64
|
+
met(BARCODE_SCANNER, {
|
|
65
|
+
podfileProperties: { 'expo.camera.barcode-scanner-enabled': 'false' },
|
|
66
|
+
})
|
|
67
|
+
).toBe(false);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('is met when the property holds any other value', () => {
|
|
71
|
+
for (const value of ['true', 'FALSE', '', 'no']) {
|
|
72
|
+
expect(
|
|
73
|
+
met(BARCODE_SCANNER, {
|
|
74
|
+
podfileProperties: { 'expo.camera.barcode-scanner-enabled': value },
|
|
75
|
+
})
|
|
76
|
+
).toBe(true);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Nothing can equal the value the product never declared, so only a property
|
|
81
|
+
// that is actually set can satisfy such a condition.
|
|
82
|
+
it('declaring no disabled value is met only while the property is set', () => {
|
|
83
|
+
const condition = { podfileProperty: 'expo.camera.barcode-scanner-enabled' };
|
|
84
|
+
expect(met(condition, { podfileProperties: {} })).toBe(false);
|
|
85
|
+
expect(
|
|
86
|
+
met(condition, { podfileProperties: { 'expo.camera.barcode-scanner-enabled': 'false' } })
|
|
87
|
+
).toBe(true);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Ruby reads an unset property and an absent value as the same nil, so a
|
|
91
|
+
// product disabled by null is disabled by default there. Comparing undefined
|
|
92
|
+
// against null instead would link it here and withhold it under CocoaPods.
|
|
93
|
+
it('declaring null as its disabled value reads the same as declaring none', () => {
|
|
94
|
+
const condition = {
|
|
95
|
+
podfileProperty: 'expo.camera.barcode-scanner-enabled',
|
|
96
|
+
disabledValue: null,
|
|
97
|
+
};
|
|
98
|
+
expect(met(condition, { podfileProperties: {} })).toBe(false);
|
|
99
|
+
expect(met(condition)).toBe(false);
|
|
100
|
+
expect(
|
|
101
|
+
met(condition, { podfileProperties: { 'expo.camera.barcode-scanner-enabled': 'false' } })
|
|
102
|
+
).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('is not met when the property itself is set to null and nothing is disabled', () => {
|
|
106
|
+
expect(
|
|
107
|
+
met(
|
|
108
|
+
{ podfileProperty: 'expo.camera.barcode-scanner-enabled' },
|
|
109
|
+
{ podfileProperties: { 'expo.camera.barcode-scanner-enabled': null } }
|
|
110
|
+
)
|
|
111
|
+
).toBe(false);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe('a condition declaring several keys', () => {
|
|
116
|
+
const condition = {
|
|
117
|
+
podName: 'ExpoCamera',
|
|
118
|
+
npmPackage: 'expo-camera',
|
|
119
|
+
podfileProperty: 'expo.camera.barcode-scanner-enabled',
|
|
120
|
+
disabledValue: 'false',
|
|
121
|
+
};
|
|
122
|
+
const options = {
|
|
123
|
+
autolinkedPackages: new Set(['expo-camera']),
|
|
124
|
+
podfileProperties: {},
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
it('is decided by its pod name alone', () => {
|
|
128
|
+
expect(met(condition, { ...options, declaredPodNames: new Set(['ExpoCamera']) })).toBe(true);
|
|
129
|
+
expect(met(condition, { ...options, declaredPodNames: new Set() })).toBe(false);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('falls through to its npm package only when it names no pod', () => {
|
|
133
|
+
const withoutPodName = { npmPackage: condition.npmPackage, ...BARCODE_SCANNER };
|
|
134
|
+
expect(met(withoutPodName, { ...options, declaredPodNames: new Set() })).toBe(true);
|
|
135
|
+
expect(met(withoutPodName, { ...options, autolinkedPackages: new Set() })).toBe(false);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('reaches its Podfile property only when it names neither', () => {
|
|
139
|
+
expect(met(BARCODE_SCANNER, { ...options, declaredPodNames: new Set() })).toBe(true);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
describe('a condition naming nothing to gate on', () => {
|
|
144
|
+
it.each([[undefined], [null], [{}], [{ disabledValue: 'false' }], ['expo-camera'], [42]])(
|
|
145
|
+
'is not met (%p)',
|
|
146
|
+
(condition) => {
|
|
147
|
+
expect(
|
|
148
|
+
met(condition, {
|
|
149
|
+
declaredPodNames: new Set(['ExpoCamera']),
|
|
150
|
+
autolinkedPackages: new Set(['expo-camera']),
|
|
151
|
+
podfileProperties: { 'expo.camera.barcode-scanner-enabled': 'true' },
|
|
152
|
+
})
|
|
153
|
+
).toBe(false);
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
describe('the label of a condition', () => {
|
|
159
|
+
it('is whichever key decides it', () => {
|
|
160
|
+
expect(autolinkConditionLabel({ podName: 'ExpoCamera', npmPackage: 'expo-camera' })).toBe(
|
|
161
|
+
'ExpoCamera'
|
|
162
|
+
);
|
|
163
|
+
expect(autolinkConditionLabel({ npmPackage: 'expo-camera', ...BARCODE_SCANNER })).toBe(
|
|
164
|
+
'expo-camera'
|
|
165
|
+
);
|
|
166
|
+
expect(autolinkConditionLabel(BARCODE_SCANNER)).toBe('expo.camera.barcode-scanner-enabled');
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('is null when it names nothing', () => {
|
|
170
|
+
expect(autolinkConditionLabel({})).toBeNull();
|
|
171
|
+
expect(autolinkConditionLabel(undefined)).toBeNull();
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
describe('the key that decides a condition', () => {
|
|
176
|
+
it('is the first one it declares', () => {
|
|
177
|
+
expect(autolinkConditionKey({ podName: 'ExpoCamera', ...BARCODE_SCANNER })).toBe('podName');
|
|
178
|
+
expect(autolinkConditionKey({ npmPackage: 'expo-camera', ...BARCODE_SCANNER })).toBe(
|
|
179
|
+
'npmPackage'
|
|
180
|
+
);
|
|
181
|
+
expect(autolinkConditionKey(BARCODE_SCANNER)).toBe('podfileProperty');
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('is null when it names nothing', () => {
|
|
185
|
+
expect(autolinkConditionKey({ disabledValue: 'false' })).toBeNull();
|
|
186
|
+
expect(autolinkConditionKey(undefined)).toBeNull();
|
|
187
|
+
});
|
|
188
|
+
});
|
|
@@ -8,10 +8,8 @@ const {
|
|
|
8
8
|
CORE_REACT_PRODUCTS,
|
|
9
9
|
collectWatchPaths,
|
|
10
10
|
textImportsReact,
|
|
11
|
-
sourceTreeImportsReact,
|
|
12
|
-
collectIgnoredDirs,
|
|
13
11
|
moduleNeedsReact,
|
|
14
|
-
|
|
12
|
+
scanAppleSources,
|
|
15
13
|
} = require('../classify');
|
|
16
14
|
|
|
17
15
|
function tmpTree(prefix, files) {
|
|
@@ -59,7 +57,7 @@ describe('textImportsReact', () => {
|
|
|
59
57
|
describe('moduleNeedsReact', () => {
|
|
60
58
|
it('returns true for the core bridge products regardless of source', () => {
|
|
61
59
|
for (const core of CORE_REACT_PRODUCTS) {
|
|
62
|
-
expect(moduleNeedsReact(core, '/nonexistent')).toBe(true);
|
|
60
|
+
expect(moduleNeedsReact(core, scanAppleSources('/nonexistent'))).toBe(true);
|
|
63
61
|
}
|
|
64
62
|
});
|
|
65
63
|
|
|
@@ -68,26 +66,26 @@ describe('moduleNeedsReact', () => {
|
|
|
68
66
|
try {
|
|
69
67
|
fs.mkdirSync(path.join(root, 'ios'));
|
|
70
68
|
fs.writeFileSync(path.join(root, 'ios', 'A.swift'), 'import ExpoModulesCore\n');
|
|
71
|
-
expect(moduleNeedsReact('ExpoAsset', root)).toBe(false);
|
|
69
|
+
expect(moduleNeedsReact('ExpoAsset', scanAppleSources(root))).toBe(false);
|
|
72
70
|
|
|
73
71
|
fs.writeFileSync(path.join(root, 'ios', 'B.mm'), '#import <React/RCTBridge.h>\n');
|
|
74
|
-
expect(moduleNeedsReact('ExpoAsset', root)).toBe(true);
|
|
72
|
+
expect(moduleNeedsReact('ExpoAsset', scanAppleSources(root))).toBe(true);
|
|
75
73
|
} finally {
|
|
76
74
|
fs.rmSync(root, { recursive: true, force: true });
|
|
77
75
|
}
|
|
78
76
|
});
|
|
79
77
|
});
|
|
80
78
|
|
|
81
|
-
describe('
|
|
79
|
+
describe('scanAppleSources().pureSwift', () => {
|
|
82
80
|
it('is true for a Swift-only source tree and false when a .mm/.cpp is present', () => {
|
|
83
81
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'expo-spm-pureswift-'));
|
|
84
82
|
try {
|
|
85
83
|
fs.mkdirSync(path.join(root, 'ios'));
|
|
86
84
|
fs.writeFileSync(path.join(root, 'ios', 'A.swift'), '// swift\n');
|
|
87
|
-
expect(
|
|
85
|
+
expect(scanAppleSources(root).pureSwift).toBe(true);
|
|
88
86
|
|
|
89
87
|
fs.writeFileSync(path.join(root, 'ios', 'B.mm'), '// objc++\n');
|
|
90
|
-
expect(
|
|
88
|
+
expect(scanAppleSources(root).pureSwift).toBe(false);
|
|
91
89
|
} finally {
|
|
92
90
|
fs.rmSync(root, { recursive: true, force: true });
|
|
93
91
|
}
|
|
@@ -99,7 +97,7 @@ describe('isPureSwift', () => {
|
|
|
99
97
|
'ios/sqlite3.c': '/* generated */\n',
|
|
100
98
|
});
|
|
101
99
|
try {
|
|
102
|
-
expect(
|
|
100
|
+
expect(scanAppleSources(root).pureSwift).toBe(false);
|
|
103
101
|
} finally {
|
|
104
102
|
fs.rmSync(root, { recursive: true, force: true });
|
|
105
103
|
}
|
|
@@ -111,7 +109,7 @@ describe('isPureSwift', () => {
|
|
|
111
109
|
'ios/Tests/fixture.c': '/* test fixture */\n',
|
|
112
110
|
});
|
|
113
111
|
try {
|
|
114
|
-
expect(
|
|
112
|
+
expect(scanAppleSources(root).pureSwift).toBe(true);
|
|
115
113
|
} finally {
|
|
116
114
|
fs.rmSync(root, { recursive: true, force: true });
|
|
117
115
|
}
|
|
@@ -123,7 +121,7 @@ describe('isPureSwift', () => {
|
|
|
123
121
|
fs.mkdirSync(path.join(root, 'ios', 'Tests'), { recursive: true });
|
|
124
122
|
fs.writeFileSync(path.join(root, 'ios', 'A.swift'), '// swift\n');
|
|
125
123
|
fs.writeFileSync(path.join(root, 'ios', 'Tests', 'T.mm'), '// objc++ in tests\n');
|
|
126
|
-
expect(
|
|
124
|
+
expect(scanAppleSources(root).pureSwift).toBe(true);
|
|
127
125
|
} finally {
|
|
128
126
|
fs.rmSync(root, { recursive: true, force: true });
|
|
129
127
|
}
|
|
@@ -149,20 +147,20 @@ describe('collectWatchPaths', () => {
|
|
|
149
147
|
});
|
|
150
148
|
});
|
|
151
149
|
|
|
152
|
-
describe('
|
|
150
|
+
describe('scanAppleSources().importsReact', () => {
|
|
153
151
|
it('scans C sources for React imports', () => {
|
|
154
152
|
const root = tmpTree('expo-spm-react-c-', {
|
|
155
153
|
'ios/bridge.c': '#import <React/RCTBridge.h>\n',
|
|
156
154
|
});
|
|
157
155
|
try {
|
|
158
|
-
expect(
|
|
156
|
+
expect(scanAppleSources(root).importsReact).toBe(true);
|
|
159
157
|
} finally {
|
|
160
158
|
fs.rmSync(root, { recursive: true, force: true });
|
|
161
159
|
}
|
|
162
160
|
});
|
|
163
161
|
});
|
|
164
162
|
|
|
165
|
-
describe('
|
|
163
|
+
describe('scanAppleSources().ignoredDirs', () => {
|
|
166
164
|
it('collects every ignored directory at any depth, relative and sorted', () => {
|
|
167
165
|
const root = tmpTree('expo-spm-ignored-', {
|
|
168
166
|
'ios/A.swift': '// swift\n',
|
|
@@ -175,7 +173,7 @@ describe('collectIgnoredDirs', () => {
|
|
|
175
173
|
'ios/Feature/Impl.swift': '// swift\n',
|
|
176
174
|
});
|
|
177
175
|
try {
|
|
178
|
-
expect(
|
|
176
|
+
expect(scanAppleSources(root).ignoredDirs).toEqual([
|
|
179
177
|
'.build',
|
|
180
178
|
'Feature/Tests',
|
|
181
179
|
'Tests',
|
|
@@ -193,7 +191,7 @@ describe('collectIgnoredDirs', () => {
|
|
|
193
191
|
'ios/Tests/node_modules/dep/D.swift': '// vendored inside tests\n',
|
|
194
192
|
});
|
|
195
193
|
try {
|
|
196
|
-
expect(
|
|
194
|
+
expect(scanAppleSources(root).ignoredDirs).toEqual(['Tests']);
|
|
197
195
|
} finally {
|
|
198
196
|
fs.rmSync(root, { recursive: true, force: true });
|
|
199
197
|
}
|
|
@@ -202,8 +200,8 @@ describe('collectIgnoredDirs', () => {
|
|
|
202
200
|
it('returns nothing for a clean source tree or a missing directory', () => {
|
|
203
201
|
const root = tmpTree('expo-spm-ignored-clean-', { 'ios/A.swift': '// swift\n' });
|
|
204
202
|
try {
|
|
205
|
-
expect(
|
|
206
|
-
expect(
|
|
203
|
+
expect(scanAppleSources(root).ignoredDirs).toEqual([]);
|
|
204
|
+
expect(scanAppleSources(path.join(root, 'missing')).ignoredDirs).toEqual([]);
|
|
207
205
|
} finally {
|
|
208
206
|
fs.rmSync(root, { recursive: true, force: true });
|
|
209
207
|
}
|