1 | let messages = [];
|
2 | let packages = [];
|
3 | let namedImports = [];
|
4 | export default function removedModule(message, namedImport, packageName) {
|
5 | if (__DEV__) {
|
6 | messages.push(message);
|
7 | packages.push(packageName);
|
8 | namedImports.push(namedImport);
|
9 | setTimeout(throwError, 1000);
|
10 | }
|
11 | }
|
12 | function throwError() {
|
13 | if (!messages.length) {
|
14 | return;
|
15 | }
|
16 | let instructions = '';
|
17 | messages = Array.from(new Set(messages));
|
18 | messages.sort();
|
19 | packages = Array.from(new Set(packages));
|
20 | packages.sort();
|
21 | namedImports = Array.from(new Set(namedImports));
|
22 | namedImports.sort();
|
23 | instructions += namedImports.join(', ');
|
24 | instructions += `.\n\n`;
|
25 | instructions += `1. Add correct versions of these packages to your project using:\n\n`;
|
26 | instructions += ` expo install ${packages.join(' ')}\n\n`;
|
27 | instructions += ` If "install" is not recognized as an expo command, update your expo-cli installation.\n\n`;
|
28 | instructions += `2. Change your imports so they use specific packages instead of the "expo" package:\n\n`;
|
29 | messages.forEach(message => {
|
30 | instructions += ` - ${message}\n`;
|
31 | });
|
32 | instructions += '\n';
|
33 | let message = `The following APIs have moved to separate packages and importing them from the "expo" package is no longer supported: ${instructions}`;
|
34 | messages = [];
|
35 | packages = [];
|
36 | namedImports = [];
|
37 | throw new Error(message);
|
38 | }
|
39 |
|
\ | No newline at end of file |