Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
settingsBlueprint: object(),
workspaceRoot: string(),
},
{
name: this.constructor.name,
},
);
this.appPath = Path.resolve(this.options.appPath);
this.rootPath = Path.resolve(this.options.root);
// Set environment variables
env('DEBUG_GLOBAL_NAMESPACE', this.options.appName);
// Core debugger, logger, and translator for the entire tool
this.debug = createDebugger('core');
this.log = createLogger();
this.msg = createTranslator(
['app', 'errors'],
[
new Path(__dirname, '../res'),
this.appPath.append('res'),
// TODO Remove in 2.0
this.appPath.append('resources'),
],
{
// TODO Change to yaml in 2.0
resourceFormat: 'json',
},
);
constructor(tool: Tool, /* test only */ testWriters: typeof BOUND_WRITERS = BOUND_WRITERS) {
super();
this.debug = createDebugger('console');
this.tool = tool;
this.writers = testWriters;
this.onError = new Event('error');
this.onRoutine = new Event('routine');
this.onRoutines = new Event('routines');
this.onStart = new Event('start');
this.onStop = new Event('stop');
this.onTask = new Event('task');
this.onTasks = new Event('tasks');
// istanbul ignore next
if (process.env.NODE_ENV !== 'test') {
process
.on('SIGINT', this.handleSignal)
.on('SIGTERM', this.handleSignal)
constructor(context: Ctx, value?: Input, options?: Options) {
super(options);
this.context = context;
this.debug = createDebugger(kebabCase(this.constructor.name));
// This is technically invalid, but we want to allow optional values.
// Luckily the input type defaults to `unknown`, so it forces consumers to validate.
// @ts-ignore
this.value = value;
this.debug('Instantiating pipeline');
}
constructor(key: string, title: string, options?: Options) {
super(title, (context, value) => this.execute(context, value));
if (!key || typeof key !== 'string') {
throw new Error('Routine key must be a valid unique string.');
}
this.key = key;
this.options = optimal({ ...options }, this.blueprint(predicates), {
name: this.constructor.name,
});
this.debug = createDebugger(['routine', this.key]);
this.onCommand = new Event('command');
this.onCommandData = new Event('command.data');
}
constructor(manager: Manager) {
this.manager = manager;
this.debug = createDebugger([manager.singularName, 'loader']);
}
constructor(tool: Tool) {
this.debug = createDebugger('config-loader');
this.tool = tool;
}
import kebabCase from 'lodash/kebabCase';
import pluralize from 'pluralize';
import { createDebugger } from '@boost/debug';
import { RuntimeError, color } from '@boost/internal';
import Loader from './Loader';
import { PluginType, Pluggable, LoadResult } from './types';
import formatModuleName from './formatModuleName';
export default class Registry {
readonly debug = createDebugger('plugin-registry');
private plugins: { [K in keyof Types]?: LoadResult[] } = {};
private toolName: string;
private types: { [K in keyof Types]?: PluginType } = {};
constructor(toolName: string) {
this.toolName = kebabCase(toolName);
}
/**
* Return a plugin loader for the defined type.
*/
createLoader(typeName: K): Loader {
return new Loader(this.getRegisteredType(typeName), this.toolName);
constructor(projectName: string, typeName: string, options: ManagerOptions) {
super(options);
this.projectName = kebabCase(projectName);
this.singularName = kebabCase(typeName);
this.pluralName = pluralize(this.singularName);
this.debug = createDebugger([this.singularName, 'manager']);
this.loader = new Loader(this);
this.debug('Creating new plugin type: %s', color.pluginName(typeName));
}
constructor(
tool: Tool,
typeName: string,
contract: Constructor | null = null,
scopes: string[] = [],
) {
this.contract = contract;
this.debug = createDebugger(`${typeName}-loader`);
this.scopes = scopes;
this.tool = tool;
this.typeName = typeName;
}