In order to allow users to override it and get auto-completion for services injections, a global Services interface mapping to all services types could be useful.
It would give something like services.d.ts in the root of projects sources:
import type { BaseServices } from 'knifecycle'; // For injector/instance etc...
declare module 'knifecycle' {
// Eventually override the process env type here
export interface Services
extends Services {
pg: PGService;
log: LogService;
// ...
}
Maybe that using this could help: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
The $autoload service type could be changed to :
{
get: (serviceName) => Initializer
list: () => Initializer[]
}
That way the whook-repl / whook create command could suggest new services to use.
Also, would be nice to add a special property to set the import.meta.url value of modules so that the build can refer to it (will avoid the need to use the INITIALIZER_PATH_MAP in the whook autoload service).
In order to allow users to override it and get auto-completion for services injections, a global Services interface mapping to all services types could be useful.
It would give something like
services.d.tsin the root of projects sources:Maybe that using this could help: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
The
$autoloadservice type could be changed to :That way the
whook-repl/whook createcommand could suggest new services to use.Also, would be nice to add a special property to set the
import.meta.urlvalue of modules so that the build can refer to it (will avoid the need to use theINITIALIZER_PATH_MAPin thewhookautoload service).