feat: rich debugging

This commit is contained in:
cha0s 2022-02-28 10:29:56 -06:00
parent e35f87b888
commit 545bfce1ab
39 changed files with 61 additions and 50 deletions

View File

@ -10,13 +10,13 @@ if ('production' !== process.env.NODE_ENV) {
catch (error) {}
}
import D from 'debug';
import flatten from 'lodash.flatten';
import intersection from 'lodash.intersection';
import neutrino from 'neutrino';
import {targetNeutrino} from '../server/commands';
import Flecks from '../server/flecks';
import D from '../debug';
const debug = D('@flecks/core/build/webpack.config.js');

View File

@ -2,8 +2,8 @@ import {fork} from 'child_process';
import {join, resolve, sep} from 'path';
import {Command} from 'commander';
import D from 'debug';
import D from './debug';
import Flecks from './server/flecks';
const {

View File

@ -0,0 +1,28 @@
import D from 'debug';
const {
VSCODE_INSPECTOR_OPTIONS,
} = process.env;
let hasInitialized;
export default (name) => {
if (!hasInitialized) {
// VSCode has a problem showing colors when formatting objects.
if (VSCODE_INSPECTOR_OPTIONS) {
const {formatArgs} = D;
D.formatArgs = function formatObjectsWithoutColor(args) {
const {useColors} = this;
if (args[0].match(/%[oO]/)) {
this.useColors = false;
}
formatArgs.call(this, args);
this.useColors = useColors;
};
D.formatters.o = undefined;
D.formatters.O = undefined;
}
// eslint-disable-next-line no-console
D.log = console.debug.bind(console);
}
return D(name);
};

View File

@ -6,11 +6,11 @@ import {
join,
} from 'path';
import D from 'debug';
import get from 'lodash.get';
import set from 'lodash.set';
import without from 'lodash.without';
import D from './debug';
import Middleware from './middleware';
const debug = D('@flecks/core/flecks');

View File

@ -3,6 +3,7 @@ import {Hooks} from './flecks';
export {default as autoentry} from './bootstrap/autoentry';
export {default as fleck} from './bootstrap/fleck';
export {default as compose} from './compose';
export {default as D} from './debug';
export {default as ensureUniqueReduction} from './ensure-unique-reduction';
export {default as EventEmitter} from './event-emitter';
export {

View File

@ -2,10 +2,11 @@ import {spawn} from 'child_process';
import {join, normalize} from 'path';
import {Argument} from 'commander';
import D from 'debug';
import flatten from 'lodash.flatten';
import rimraf from 'rimraf';
import D from '../debug';
const {
FLECKS_CORE_ROOT = process.cwd(),
} = process.env;

View File

@ -13,9 +13,9 @@ import {
import babelmerge from 'babel-merge';
import compileLoader from '@neutrinojs/compile-loader';
import D from 'debug';
import R from '../bootstrap/require';
import D from '../debug';
import Flecks from '../flecks';
const {

View File

@ -19,7 +19,6 @@
],
"dependencies": {
"@flecks/core": "^1.0.1",
"debug": "4.3.1",
"sequelize": "^6.3.5",
"sqlite3": "^5.0.2"
},

View File

@ -1,5 +1,4 @@
import {ByType} from '@flecks/core';
import D from 'debug';
import {ByType, D} from '@flecks/core';
import Sequelize from 'sequelize';
const debug = D('@flecks/db/server/connection');

View File

@ -3,7 +3,7 @@ import {mkdir} from 'fs/promises';
import {tmpdir} from 'os';
import {join} from 'path';
import D from 'debug';
import {D} from '@flecks/core';
const debug = D('@flecks/docker/container');

View File

@ -1,9 +1,9 @@
const {join} = require('path');
const {D} = require('@flecks/core');
const {Flecks} = require('@flecks/core/server');
const node = require('@neutrinojs/node');
const babelmerge = require('babel-merge');
const D = require('debug');
const glob = require('glob');
const {

View File

@ -1,8 +1,8 @@
import {stat, unlink} from 'fs/promises';
import {join} from 'path';
import {D} from '@flecks/core';
import chokidar from 'chokidar';
import D from 'debug';
import glob from 'glob';
import {

View File

@ -37,7 +37,6 @@
"@flecks/core": "^1.0.1",
"@neutrinojs/web": "^9.1.0",
"compression": "^1.7.4",
"debug": "4.3.1",
"express": "^4.17.1",
"glob": "^7.2.0",
"html-webpack-plugin": "^4.5.0",

View File

@ -1,5 +1,4 @@
import D from 'debug';
import {Flecks} from '@flecks/core';
import {D, Flecks} from '@flecks/core';
import Progress from './progress';

View File

@ -1,4 +1,4 @@
import D from 'debug';
import {D} from '@flecks/core';
const debug = D('@flecks/http/progress');

View File

@ -1,6 +1,6 @@
const {D} = require('@flecks/core');
const {Flecks} = require('@flecks/core/server');
const web = require('@neutrinojs/web');
const D = require('debug');
const {EnvironmentPlugin} = require('webpack');
const devServer = require('./dev-server');

View File

@ -4,8 +4,8 @@ const {
join,
} = require('path');
const {D} = require('@flecks/core');
const {Flecks, require: R} = require('@flecks/core/server');
const D = require('debug');
const glob = require('glob');
const debug = D('@flecks/http/runtime');

View File

@ -2,8 +2,8 @@ import {createReadStream} from 'fs';
import {createServer, ServerResponse} from 'http';
import {join} from 'path';
import {D} from '@flecks/core';
import compression from 'compression';
import D from 'debug';
import express from 'express';
import httpProxy from 'http-proxy';
import flatten from 'lodash.flatten';

View File

@ -1,6 +1,5 @@
import {Hooks} from '@flecks/core';
import {D, Hooks} from '@flecks/core';
import {Flecks, spawnWith} from '@flecks/core/server';
import D from 'debug';
import {configSource, inlineConfig} from './config';
import {createHttpServer} from './http';

View File

@ -40,7 +40,6 @@
"@hot-loader/react-dom": "^17.0.1",
"@neutrinojs/react": "^9.4.0",
"classnames": "^2.3.1",
"debug": "4.3.1",
"history": "^5.3.0",
"prop-types": "^15.7.2",
"react": "^17.0.1",

View File

@ -1,6 +1,5 @@
import {Hooks} from '@flecks/core';
import {D, Hooks} from '@flecks/core';
import {hydrate, render} from '@hot-loader/react-dom';
import D from 'debug';
import React from 'react';
// eslint-disable-next-line import/no-extraneous-dependencies

View File

@ -1,4 +1,4 @@
import D from 'debug';
import {D} from '@flecks/core';
import React from 'react';
// eslint-disable-next-line import/no-extraneous-dependencies

View File

@ -23,7 +23,6 @@
"@flecks/core": "^1.0.1",
"@socket.io/redis-adapter": "7.1.0",
"connect-redis": "^5.0.0",
"debug": "4.3.1",
"express-session": "^1.17.1",
"redis": "4.0.3"
},

View File

@ -1,7 +1,6 @@
import {Hooks} from '@flecks/core';
import {D, Hooks} from '@flecks/core';
import redisAdapter from '@socket.io/redis-adapter';
import ConnectRedis from 'connect-redis';
import D from 'debug';
import session from 'express-session';
import createClient from '../create-client';

View File

@ -1,5 +1,4 @@
import {ensureUniqueReduction, Hooks} from '@flecks/core';
import D from 'debug';
import {D, ensureUniqueReduction, Hooks} from '@flecks/core';
import {Provider} from 'react-redux';
import {hydrateServer} from './actions';

View File

@ -3,8 +3,8 @@ import {readdir} from 'fs/promises';
import {tmpdir} from 'os';
import {join} from 'path';
import {D} from '@flecks/core';
import commandExists from 'command-exists';
import D from 'debug';
const debug = D('@flecks/repl/commands');

View File

@ -4,7 +4,7 @@ import {tmpdir} from 'os';
import {join} from 'path';
import {start} from 'repl';
import D from 'debug';
import {D} from '@flecks/core';
const debug = D('@flecks/repl');

View File

@ -2,8 +2,7 @@ import {mkdir} from 'fs/promises';
import {tmpdir} from 'os';
import {join} from 'path';
import D from 'debug';
import {Flecks} from '@flecks/core';
import {D, Flecks} from '@flecks/core';
const {version} = require('../package.json');

View File

@ -1,10 +1,10 @@
const {join} = require('path');
const {D} = require('@flecks/core');
const {Flecks} = require('@flecks/core/server');
const banner = require('@neutrinojs/banner');
const node = require('@neutrinojs/node');
const startServer = require('@neutrinojs/start-server');
const D = require('debug');
const runtime = require('./runtime');

View File

@ -24,7 +24,6 @@
],
"dependencies": {
"@flecks/core": "^1.0.1",
"debug": "4.3.1",
"msgpack-lite": "^0.1.26",
"proxy-addr": "^2.0.6",
"schemapack": "^1.4.2",

View File

@ -1,10 +1,8 @@
import {promisify} from 'util';
import D from 'debug';
import {compose, D, EventEmitter} from '@flecks/core';
import io from 'socket.io-client';
import {compose, EventEmitter} from '@flecks/core';
import Socket from '../socket';
const debug = D('@flecks/socket/client/socket');

View File

@ -1,4 +1,4 @@
import D from 'debug';
import {D} from '@flecks/core';
const {
NODE_ENV,

View File

@ -1,4 +1,4 @@
import D from 'debug';
import {D} from '@flecks/core';
const debug = D('@flecks/socket/intercom');

View File

@ -1,7 +1,6 @@
import {promisify} from 'util';
import {compose, EventEmitter} from '@flecks/core';
import D from 'debug';
import {compose, D, EventEmitter} from '@flecks/core';
import Socket from '../socket';

View File

@ -1,4 +1,4 @@
import D from 'debug';
import {D} from '@flecks/core';
import proxyaddr from 'proxy-addr';
import SocketIoServer from 'socket.io';

View File

@ -1,5 +1,4 @@
import {ByType} from '@flecks/core';
import D from 'debug';
import {ByType, D} from '@flecks/core';
import normalize from './normalize';
import acceptor from './packet/acceptor';

View File

@ -33,7 +33,6 @@
"@flecks/react": "^1.0.2",
"@flecks/redux": "^1.0.2",
"bcrypt": "^5.0.0",
"debug": "4.3.1",
"express": "^4.17.1",
"express-session": "1.17.1",
"passport": "0.4.1",

View File

@ -1,5 +1,4 @@
import {Flecks, Hooks} from '@flecks/core';
import D from 'debug';
import {D, Flecks, Hooks} from '@flecks/core';
import passport from 'passport';
import LogOps from 'passport/lib/http/request';

View File

@ -1,5 +1,4 @@
import {Hooks} from '@flecks/core';
import D from 'debug';
import {D, Hooks} from '@flecks/core';
import express from 'express';
import expressSession from 'express-session';