expo 58.0.1 → 58.0.2

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.
@@ -8,10 +8,8 @@ const {
8
8
  CORE_REACT_PRODUCTS,
9
9
  collectWatchPaths,
10
10
  textImportsReact,
11
- sourceTreeImportsReact,
12
- collectIgnoredDirs,
13
11
  moduleNeedsReact,
14
- isPureSwift,
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('isPureSwift', () => {
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(isPureSwift(root)).toBe(true);
85
+ expect(scanAppleSources(root).pureSwift).toBe(true);
88
86
 
89
87
  fs.writeFileSync(path.join(root, 'ios', 'B.mm'), '// objc++\n');
90
- expect(isPureSwift(root)).toBe(false);
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(isPureSwift(root)).toBe(false);
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(isPureSwift(root)).toBe(true);
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(isPureSwift(root)).toBe(true);
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('sourceTreeImportsReact', () => {
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(sourceTreeImportsReact(path.join(root, 'ios'))).toBe(true);
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('collectIgnoredDirs', () => {
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(collectIgnoredDirs(path.join(root, 'ios'))).toEqual([
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(collectIgnoredDirs(path.join(root, 'ios'))).toEqual(['Tests']);
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(collectIgnoredDirs(path.join(root, 'ios'))).toEqual([]);
206
- expect(collectIgnoredDirs(path.join(root, 'apple'))).toEqual([]);
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
  }