This commit is contained in:
2019-07-06 00:36:18 +02:00
parent 4db704759e
commit baea9498be
16 changed files with 157 additions and 39 deletions

View File

@@ -1,13 +0,0 @@
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: [
[require.resolve('babel-plugin-module-resolver'), {
alias: {
'@babel/runtime': '../node_modules/@babel/runtime',
}
}]
]
};
};

View File

@@ -13,7 +13,7 @@ import {
log,
network,
show,
} from 'react-native-debug-console';
} from 'react-native-debug-console/src';
network.attach();
log.attach(true);

View File

@@ -1,3 +1,3 @@
const config = require('../babel.config');
const config = require('../../babel.config');
module.exports = config;

View File

@@ -6,6 +6,7 @@ const path = require('path');
module.exports = {
watchFolders: [
__dirname,
path.join(__dirname, '..', 'lib'),
path.join(__dirname, '..', '..', 'node_modules'),
]
};

View File

@@ -1,3 +1,3 @@
const config = require('../babel.config');
const config = require('../../babel.config');
module.exports = config;

View File

@@ -1,4 +1,3 @@
module.exports = {
preset: "react-native",
rootDir: '..',
};
const config = require('../../jest.config');
module.exports = config;

View File

@@ -5,6 +5,9 @@
"repository": {
"url": "https://github.com/morten-olsen/react-native-debugger"
},
"scripts": {
"test": "jest"
},
"license": "MIT",
"dependencies": {
"react-native-json-tree": "^1.2.0",

View File

@@ -65,12 +65,11 @@ class Log {
}
attach(keep) {
global.proxyConsole = proxyConsole;
const redirected = Object.keys(proxyConsole).reduce((output, key) => ({
...output,
[key]: keep ? (...args) => proxyConsole[key](...args) : () => {},
}), {});
window.console = {
global.console = {
...redirected,
error: (...data) => this.error(data, keep),
warn: (...data) => this.warn(data, keep),
@@ -79,12 +78,14 @@ class Log {
debug: (...data) => this.debug(data, keep),
verbose: (...data) => this.debug(data, keep),
};
if (global.ErrorUtils) {
/*if (global.ErrorUtils) {
global.ErrorUtils.setGlobalHandler((err, fatal) => {
this.error([err], keep);
});
}*/
if (global.addEventListener) {
global.addEventListener('error', this.handleError);
}
window.addEventListener('error', this.handleError);
}
detach() {
@@ -92,7 +93,9 @@ class Log {
window.console[key] = proxies[key];
});
window.removeEventListener('error', this.handleError);
if (global.removeEventListener) {
global.removeEventListener('error', this.handleError);
}
}
}

View File

@@ -2,18 +2,18 @@ import React from 'react';
import renderer from 'react-test-renderer';
import {
DevTool,
} from 'react-native-debug-console';
import Console from 'react-native-debug-console/src/components/DevTool/Console';
import ConsoleOutput, { Row as OutputRow} from 'react-native-debug-console/src/components/DevTool/Console/Output';
import ConsoleInput from 'react-native-debug-console/src/components/DevTool/Console/Input';
} from '../src';
import Console from '../src/components/DevTool/Console';
import ConsoleOutput, { Row as OutputRow} from '../src/components/DevTool/Console/Output';
import ConsoleInput from '../src/components/DevTool/Console/Input';
import Requests from 'react-native-debug-console/src/components/DevTool/Requests';
import RequestsDetails from 'react-native-debug-console/src/components/DevTool/Requests/Details';
import RequestsList from 'react-native-debug-console/src/components/DevTool/Requests/List';
import Requests from '../src/components/DevTool/Requests';
import RequestsDetails from '../src/components/DevTool/Requests/Details';
import RequestsList from '../src/components/DevTool/Requests/List';
import Storage from 'react-native-debug-console/src/components/DevTool/Storage';
import StorageKeys from 'react-native-debug-console/src/components/DevTool/Storage/Keys';
import StorageValues from 'react-native-debug-console/src/components/DevTool/Storage/Value';
import Storage from '../src/components/DevTool/Storage';
import StorageKeys from '../src/components/DevTool/Storage/Keys';
import StorageValues from '../src/components/DevTool/Storage/Value';
const createLog = () => {
const listeners = [];