2018-03-17 20:33:00 +01:00
|
|
|
/* global __DEV__, localStorage */
|
2020-03-26 21:02:52 +01:00
|
|
|
if (typeof Buffer === 'undefined') global.Buffer = require('buffer').Buffer;
|
2018-03-17 21:39:21 +01:00
|
|
|
if (typeof __dirname === 'undefined') global.__dirname = '/';
|
|
|
|
if (typeof __filename === 'undefined') global.__filename = '';
|
2018-01-30 23:42:38 +01:00
|
|
|
if (typeof process === 'undefined') {
|
2018-03-17 21:39:21 +01:00
|
|
|
global.process = require('process');
|
2018-01-30 23:42:38 +01:00
|
|
|
} else {
|
2018-03-17 21:39:21 +01:00
|
|
|
const bProcess = require('process');
|
2018-01-30 23:42:38 +01:00
|
|
|
for (var p in bProcess) {
|
|
|
|
if (!(p in process)) {
|
2018-03-17 21:39:21 +01:00
|
|
|
process[p] = bProcess[p];
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-17 21:39:21 +01:00
|
|
|
process.browser = false;
|
2018-01-30 23:42:38 +01:00
|
|
|
|
2020-06-11 19:34:28 +02:00
|
|
|
// global.net = require('react-native-tcp');
|
|
|
|
// global.tls = require('react-native-tcp/tls');
|
|
|
|
//
|
|
|
|
// since new TCP/TLS module for React Native has different api from what is expected from nodejs/net & nodejs/tls
|
|
|
|
// (or from old module) we wrap this module in adapter:
|
|
|
|
global.net = require('./blue_modules/net');
|
|
|
|
global.tls = require('./blue_modules/tls');
|
2020-03-26 17:37:11 +01:00
|
|
|
|
2018-01-30 23:42:38 +01:00
|
|
|
// global.location = global.location || { port: 80 }
|
2018-03-17 21:39:21 +01:00
|
|
|
const isDev = typeof __DEV__ === 'boolean' && __DEV__;
|
2020-06-01 14:54:23 +02:00
|
|
|
process.env.NODE_ENV = isDev ? 'development' : 'production';
|
2018-01-30 23:42:38 +01:00
|
|
|
if (typeof localStorage !== 'undefined') {
|
2018-03-17 21:39:21 +01:00
|
|
|
localStorage.debug = isDev ? '*' : '';
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
2021-04-15 19:52:48 +02:00
|
|
|
|
|
|
|
// If using the crypto shim, uncomment the following line to ensure
|
|
|
|
// crypto is loaded first, so it can populate global.crypto
|
|
|
|
require('crypto');
|