UNPKG

1.45 kBJavaScriptView Raw
1let messages = [];
2let packages = [];
3let namedImports = [];
4export default function deprecatedModule(message, namedImport, packageName) {
5 if (__DEV__) {
6 messages.push(message);
7 packages.push(packageName);
8 namedImports.push(namedImport);
9 setTimeout(logWarning, 1000);
10 }
11}
12function logWarning() {
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 console.log(`The following APIs have moved to separate packages and importing them from the "expo" package is deprecated: ${instructions}`);
34 messages = [];
35 packages = [];
36 namedImports = [];
37}
38//# sourceMappingURL=deprecatedModule.js.map
\No newline at end of file