/
definitions.ts
53 lines (47 loc) · 1.71 KB
/
definitions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { ConsoleHandler } from '@debugr/console';
import { Logger, Plugin } from '@debugr/core';
import { ServiceDefinition } from 'dicc';
import { IndentationText, NewLineKind, Project, QuoteKind } from 'ts-morph';
import { Argv } from './argv';
import { ConfigLoader } from './configLoader';
import { Dicc } from './dicc';
import { DiccConfig } from './types';
export { Argv } from './argv';
export { Autowiring } from './autowiring';
export { Checker } from './checker';
export { Compiler } from './compiler';
export { ConfigLoader } from './configLoader';
export { DefinitionScanner } from './definitionScanner';
export { ServiceRegistry } from './serviceRegistry';
export { SourceFiles } from './sourceFiles';
export { TypeHelper } from './typeHelper';
export namespace debug {
export const logger = {
factory: (plugins: Plugin[]) => new Logger({
globalContext: {},
plugins,
}),
} satisfies ServiceDefinition<Logger>;
export const console = {
factory: (argv: Argv) => new ConsoleHandler({ threshold: argv.logLevel, timestamp: false }),
scope: 'private',
anonymous: true,
} satisfies ServiceDefinition<ConsoleHandler, Plugin>;
}
export const config = {
factory: async (loader: ConfigLoader) => loader.load(),
anonymous: true,
} satisfies ServiceDefinition<DiccConfig>;
export const project = {
factory: (config: DiccConfig) => new Project({
tsConfigFilePath: config.project,
manipulationSettings: {
indentationText: IndentationText.TwoSpaces,
newLineKind: NewLineKind.LineFeed,
quoteKind: QuoteKind.Single,
useTrailingCommas: true,
},
}),
anonymous: true,
} satisfies ServiceDefinition<Project>;
export const dicc = Dicc satisfies ServiceDefinition<Dicc>;