node-dependency-injection 4.0.0-alpha.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/.eslintrc +16 -0
  2. package/.github/workflows/build.yml +24 -0
  3. package/.github/workflows/publish.yml +43 -0
  4. package/.mocharc.yaml +0 -1
  5. package/CHANGELOG-3.md +6 -1
  6. package/CONTRIBUTING.md +2 -2
  7. package/README.md +340 -112
  8. package/UPGRADE-3.0.md +4 -1
  9. package/UPGRADE-4.0.md +50 -0
  10. package/assets/logo.png +0 -0
  11. package/bin/Resources/services.yaml +7 -0
  12. package/bin/Services/File/XmlAdapter.js +53 -0
  13. package/bin/ndi-config:create.js +2 -1
  14. package/bin/ndi-container:graph.js +82 -0
  15. package/bin/ndi-container:service.js +5 -0
  16. package/bin/ndi-container:validate.js +120 -0
  17. package/bin/ndi.js +2 -0
  18. package/dist/bin/Resources/services.yaml +7 -0
  19. package/dist/bin/Services/File/BaseAdapter.js +1 -50
  20. package/dist/bin/Services/File/FileManager.js +1 -55
  21. package/dist/bin/Services/File/JsAdapter.js +1 -62
  22. package/dist/bin/Services/File/JsonAdapter.js +1 -60
  23. package/dist/bin/Services/File/XmlAdapter.js +1 -0
  24. package/dist/bin/Services/File/YamlAdapter.js +1 -67
  25. package/dist/bin/ndi-config:check.js +1 -55
  26. package/dist/bin/ndi-config:create.js +1 -40
  27. package/dist/bin/ndi-container:graph.js +2 -0
  28. package/dist/bin/ndi-container:service.js +1 -131
  29. package/dist/bin/ndi-container:validate.js +2 -0
  30. package/dist/bin/ndi.js +1 -9
  31. package/dist/lib/Autowire.js +1 -281
  32. package/dist/lib/AutowireIdentifier.js +1 -0
  33. package/dist/lib/Compiler.js +1 -101
  34. package/dist/lib/CompilerPass/AutowireOverridePass.js +1 -0
  35. package/dist/lib/CompilerPass/DecoratePass.js +1 -118
  36. package/dist/lib/CompilerPass/OptimizePass.js +1 -60
  37. package/dist/lib/CompilerPass/RemovePass.js +1 -57
  38. package/dist/lib/CompilerPass/index.js +1 -131
  39. package/dist/lib/Condition.js +1 -0
  40. package/dist/lib/ContainerBuilder.js +1 -463
  41. package/dist/lib/ContainerValidator.js +1 -0
  42. package/dist/lib/Definition.js +1 -371
  43. package/dist/lib/Dump/Dumper.js +1 -0
  44. package/dist/lib/Dump/JsDumper.js +1 -0
  45. package/dist/lib/Dump/JsonDumper.js +1 -0
  46. package/dist/lib/Dump/XmlDumper.js +1 -0
  47. package/dist/lib/Dump/YamlDumper.js +1 -0
  48. package/dist/lib/Exception/AbstractServiceException.js +1 -47
  49. package/dist/lib/Exception/AttributesMapException.js +1 -44
  50. package/dist/lib/Exception/CannotAutowireOverrideSearch.js +1 -0
  51. package/dist/lib/Exception/ConfigurationFileNotFoundException.js +1 -47
  52. package/dist/lib/Exception/ContainerDefaultDirMustBeSet.js +1 -0
  53. package/dist/lib/Exception/ContainerValidationError.js +1 -0
  54. package/dist/lib/Exception/DefinitionNotFoundException.js +1 -47
  55. package/dist/lib/Exception/FrozenContainerException.js +1 -44
  56. package/dist/lib/Exception/KeyedGroupNoDefaultException.js +1 -0
  57. package/dist/lib/Exception/KeyedGroupNotFoundException.js +1 -0
  58. package/dist/lib/Exception/KeyedServiceNotFoundException.js +1 -0
  59. package/dist/lib/Exception/LoadMethodNotFoundException.js +1 -47
  60. package/dist/lib/Exception/LoggerWarnMethodNotFoundException.js +1 -44
  61. package/dist/lib/Exception/MethodCallEmptyException.js +1 -44
  62. package/dist/lib/Exception/MethodCallNotFoundException.js +1 -47
  63. package/dist/lib/Exception/NotAbstractServiceException.js +1 -47
  64. package/dist/lib/Exception/PrivateServiceException.js +1 -47
  65. package/dist/lib/Exception/ProcessMethodNotFoundException.js +1 -47
  66. package/dist/lib/Exception/RootDirectoryMustBeAbsolute.js +1 -0
  67. package/dist/lib/Exception/RootDirectoryNotFound.js +1 -0
  68. package/dist/lib/Exception/ServiceCircularReferenceException.js +1 -44
  69. package/dist/lib/Exception/ServiceFileNotAbsolute.js +1 -0
  70. package/dist/lib/Exception/ServiceFileNotFoundException.js +1 -47
  71. package/dist/lib/Exception/ServiceFileNotLoadedException.js +1 -47
  72. package/dist/lib/Exception/ServiceFileNotValidExtension.js +1 -0
  73. package/dist/lib/Exception/ServiceNotFoundException.js +1 -48
  74. package/dist/lib/Exception/UnableToGetInstanceFromId.js +1 -0
  75. package/dist/lib/Exception/WrongCompilerPassTypeException.js +1 -47
  76. package/dist/lib/Exception/WrongDefinitionException.js +1 -44
  77. package/dist/lib/GraphExporter.js +1 -0
  78. package/dist/lib/InstanceManager.js +1 -363
  79. package/dist/lib/KeyedGroupReference.js +1 -0
  80. package/dist/lib/KeyedReference.js +1 -0
  81. package/dist/lib/Loader/Argument.js +1 -0
  82. package/dist/lib/Loader/FileLoader.js +1 -417
  83. package/dist/lib/Loader/JsFileLoader.js +1 -68
  84. package/dist/lib/Loader/JsonFileLoader.js +1 -40
  85. package/dist/lib/Loader/XmlFileLoader.js +1 -0
  86. package/dist/lib/Loader/YamlFileLoader.js +1 -88
  87. package/dist/lib/LoggerHelper.js +1 -0
  88. package/dist/lib/PackageReference.js +1 -37
  89. package/dist/lib/ParameterReference.js +1 -0
  90. package/dist/lib/PassConfig.js +1 -78
  91. package/dist/lib/Reference.js +1 -49
  92. package/dist/lib/ServiceFile.js +1 -0
  93. package/dist/lib/TagReference.js +1 -37
  94. package/dist/lib/ValidationResult.js +1 -0
  95. package/dist/lib/index.js +1 -79
  96. package/dist/lib/schema/services.xsd +163 -0
  97. package/dist/lib/types/index.d.ts +218 -10
  98. package/dist/lib/types/tests.ts +36 -2
  99. package/package.json +25 -11
  100. package/tsconfig.json +8 -1
  101. package/.travis.yml +0 -14
@@ -1,10 +1,77 @@
1
1
  // Only for typings exports
2
2
 
3
+ export type AutowireIdStrategy = 'legacy' | 'readable';
4
+
3
5
  export type PassConfigHook = 'beforeOptimization' | 'optimize' | 'beforeRemoving' | 'remove' | 'afterRemoving';
4
6
 
5
7
  export type Parameter = string | boolean | object | any[];
6
8
 
7
- export type Argument = TagReference | Reference | PackageReference | any;
9
+ export type Argument = TagReference | Reference | KeyedReference | KeyedGroupReference | PackageReference | ParameterReference | any;
10
+
11
+ export type ValidationSeverity = 'ERROR' | 'WARN' | 'INFO';
12
+
13
+ export type ValidationIssueType =
14
+ | 'missing_dependency'
15
+ | 'circular_dependency'
16
+ | 'unresolved_parameter'
17
+ | 'unused_nullable_fallback'
18
+ | 'deprecated_service_in_use'
19
+ | 'orphan_tagged_service'
20
+ | 'keyed_group_no_default';
21
+
22
+ export interface ValidationIssue {
23
+ severity: ValidationSeverity;
24
+ type: ValidationIssueType;
25
+ service: string;
26
+ detail: string;
27
+ message: string;
28
+ }
29
+
30
+ export interface CompileOptions {
31
+ validate?: boolean;
32
+ throwOnError?: boolean;
33
+ }
34
+
35
+ export type GraphFormat = 'mermaid' | 'dot' | 'json';
36
+
37
+ export interface ExportGraphOptions {
38
+ filter?: RegExp | string | ((serviceId: string) => boolean);
39
+ tag?: string;
40
+ root?: string;
41
+ depth?: number;
42
+ excludePrivate?: boolean;
43
+ }
44
+
45
+ export interface GraphNode {
46
+ id: string;
47
+ class: string | null;
48
+ scope: 'singleton' | 'prototype';
49
+ lazy: boolean;
50
+ keyed?: {
51
+ group: string;
52
+ key: string;
53
+ default: boolean;
54
+ };
55
+ }
56
+
57
+ export interface GraphEdge {
58
+ from: string;
59
+ to: string;
60
+ type: 'constructor' | 'lazy' | 'method';
61
+ }
62
+
63
+ export interface GraphGroup {
64
+ name: string;
65
+ type: 'keyed';
66
+ services: string[];
67
+ default: string | null;
68
+ }
69
+
70
+ export interface ExportedGraphJson {
71
+ nodes: GraphNode[];
72
+ edges: GraphEdge[];
73
+ groups: GraphGroup[];
74
+ }
8
75
 
9
76
  export interface Extension {
10
77
  load: Function;
@@ -12,10 +79,14 @@ export interface Extension {
12
79
 
13
80
  export interface Logger {
14
81
  warn(message?: any, ...optionalParams: any[]): void;
82
+ info?(message?: any, ...optionalParams: any[]): void;
83
+ debug?(message?: any, ...optionalParams: any[]): void;
15
84
  }
16
85
 
86
+ export type Verbosity = 'silent' | 'warn' | 'info' | 'debug';
87
+
17
88
  export interface CompilerPass {
18
- process(container: ContainerBuilder): void;
89
+ process(container: ContainerBuilder): Promise<void>;
19
90
  }
20
91
 
21
92
  export interface Factory {
@@ -36,14 +107,18 @@ export interface Tag {
36
107
  export class InstanceManager {
37
108
  constructor(containerBuilder: ContainerBuilder, definitions: Map<string, Definition>, alias: Map<string, string>);
38
109
 
39
- getInstance(id: string, bypassPublic?: boolean): any;
110
+ getInstance(id: any, bypassPublic?: boolean): any;
40
111
 
41
112
  getInstanceFromDefinition(definition: Definition): any;
113
+
114
+ searchDefinitionsToOverrideArgs(): Map<string, Definition>;
115
+
116
+ searchNotOverrideDefinitionsByObject(Object: any): Map<string, Definition>;
42
117
  }
43
118
 
44
119
  // Package exports
45
120
  export class ContainerBuilder {
46
- readonly defaultDir: string;
121
+ defaultDir: string;
47
122
  readonly containerReferenceAsService: boolean;
48
123
  readonly definitions: Map<string, Definition>;
49
124
  readonly instanceManager: InstanceManager;
@@ -51,25 +126,40 @@ export class ContainerBuilder {
51
126
  readonly services: Map<string, any>;
52
127
  frozen: boolean;
53
128
  logger: Logger;
129
+ verbosity: Verbosity;
130
+ autowire: Autowire | null;
54
131
 
55
132
  constructor(containerReferenceAsService?: boolean, defaultDir?: string | null);
56
133
 
57
134
  addCompilerPass(compilerPass: any, type?: PassConfigHook, priority?: number): void;
58
135
 
59
- compile(): void;
136
+ compile(): Promise<undefined>;
137
+ compile(options: CompileOptions & { validate: true }): Promise<ValidationResult>;
138
+ compile(options?: CompileOptions): Promise<ValidationResult | undefined>;
139
+
140
+ exportGraph(format: 'json', options?: ExportGraphOptions): ExportedGraphJson;
141
+ exportGraph(format?: Exclude<GraphFormat, 'json'>, options?: ExportGraphOptions): string;
142
+ exportGraph(format: GraphFormat, options?: ExportGraphOptions): string | ExportedGraphJson;
60
143
 
61
- findDefinition(key: string): Definition;
144
+ findDefinition(key: string): Promise<Definition>;
62
145
 
63
- findTaggedServiceIds(name: string): Map<any, any>;
146
+ findTaggedServiceIds(name: string): Iterable<{id: string, definition: Definition}>;
64
147
 
65
148
  get<T = any>(id: string): T;
149
+ get(id: any): any;
66
150
 
67
151
  getDefinition(key: string): Definition;
68
152
 
69
153
  getParameter<T extends Parameter>(key: string): T;
70
154
 
155
+ getKeyed<T = any>(group: string, key?: string | null): T;
156
+
157
+ getKeyedGroup<T = any>(group: string): Map<string, T>;
158
+
71
159
  has(key: string): boolean;
72
160
 
161
+ hasAlias(alias: string): boolean;
162
+
73
163
  hasDefinition(key: string): boolean;
74
164
 
75
165
  hasParameter(key: string): boolean;
@@ -78,6 +168,8 @@ export class ContainerBuilder {
78
168
 
79
169
  register(id: string, object?: any, args?: Argument[]): Definition;
80
170
 
171
+ registerKeyed(group: string, key: string, object?: any, args?: Argument[]): Definition;
172
+
81
173
  registerExtension(extension: Extension): void;
82
174
 
83
175
  remove(id: string): void;
@@ -98,6 +190,7 @@ export class Definition {
98
190
  Object: any
99
191
  args: Argument[];
100
192
  appendArgs: Argument[];
193
+ overrideArgs: Argument[];
101
194
  public: boolean;
102
195
  deprecated: string;
103
196
  lazy: boolean;
@@ -107,14 +200,20 @@ export class Definition {
107
200
  shared: boolean;
108
201
  abstract: boolean;
109
202
  parent: string;
203
+ keyedGroup: string | null;
204
+ keyedKey: string | null;
205
+ keyedDefault: boolean;
110
206
  readonly factory: Factory | null;
111
207
  readonly calls: Call[];
112
208
  readonly tags: Tag[];
113
209
  readonly properties: Map<string, any>;
210
+ readonly condition: Condition | null;
211
+ readonly whenMissingId: string | null;
212
+ readonly whenServiceExistsId: string | null;
114
213
 
115
- constructor(object?: any, args?: Argument[]);
214
+ constructor(object?: any, args?: Argument[], overrideArgs?: Argument[]);
116
215
 
117
- addArgument(argument: Argument): Definition;
216
+ addArgument(argument: Argument, append?: boolean): Definition;
118
217
 
119
218
  addMethodCall(method: string, args: any[]): Definition;
120
219
 
@@ -124,8 +223,16 @@ export class Definition {
124
223
 
125
224
  isPublic(bypassPublic?: boolean): boolean;
126
225
 
226
+ setDefault(value: boolean): Definition;
227
+
127
228
  setFactory(Object: Reference | Object, method: string): void;
128
229
 
230
+ setCondition(condition: Condition): Definition;
231
+
232
+ whenMissing(id: string): Definition;
233
+
234
+ whenServiceExists(id: string): Definition;
235
+
129
236
  }
130
237
 
131
238
  export class PackageReference {
@@ -147,6 +254,19 @@ export class TagReference {
147
254
  constructor(name: string);
148
255
  }
149
256
 
257
+ export class KeyedReference {
258
+ readonly group: string;
259
+ readonly key: string;
260
+
261
+ constructor(group: string, key: string);
262
+ }
263
+
264
+ export class KeyedGroupReference {
265
+ readonly group: string;
266
+
267
+ constructor(group: string);
268
+ }
269
+
150
270
  export class PassConfig {
151
271
  static readonly TYPE_BEFORE_OPTIMIZATION: PassConfigHook;
152
272
  static readonly TYPE_OPTIMIZE: PassConfigHook;
@@ -160,7 +280,7 @@ export class PassConfig {
160
280
  export class FileLoader {
161
281
  constructor(container: ContainerBuilder);
162
282
 
163
- load(file: string | null): void;
283
+ load(file: string | null): Promise<void>;
164
284
  }
165
285
 
166
286
  export class YamlFileLoader extends FileLoader {
@@ -171,3 +291,91 @@ export class JsFileLoader extends FileLoader {
171
291
 
172
292
  export class JsonFileLoader extends JsFileLoader {
173
293
  }
294
+
295
+ export class XmlFileLoader extends FileLoader {
296
+ }
297
+
298
+ export class Autowire {
299
+ constructor (container: ContainerBuilder, tsConfigFullPath?: string);
300
+
301
+ get container (): ContainerBuilder;
302
+
303
+ process (): Promise<void>;
304
+
305
+ addExclude(excludedPath: string): void;
306
+
307
+ set serviceFile(serviceFile: ServiceFile);
308
+
309
+ get serviceFile(): ServiceFile;
310
+
311
+ get idStrategy(): AutowireIdStrategy;
312
+
313
+ makeIdReadable(): void;
314
+
315
+ makeIdLegacy(): void;
316
+ }
317
+
318
+ export class ServiceFile {
319
+ constructor (servicesDumpPath: string, absolutePath?: boolean);
320
+
321
+ generateFromContainer(container: ContainerBuilder): Promise<void>;
322
+ }
323
+
324
+ export class ParameterReference {
325
+ readonly key: string;
326
+
327
+ constructor(key: string);
328
+ }
329
+
330
+ export class ValidationResult {
331
+ readonly errors: ValidationIssue[];
332
+ readonly warnings: ValidationIssue[];
333
+ readonly info: ValidationIssue[];
334
+ readonly isValid: boolean;
335
+ serviceCount: number;
336
+
337
+ addError(type: ValidationIssueType, service: string, detail: string, message: string): void;
338
+ addWarning(type: ValidationIssueType, service: string, detail: string, message: string): void;
339
+ addInfo(type: ValidationIssueType, service: string, detail: string, message: string): void;
340
+ }
341
+
342
+ export class ContainerValidationError extends Error {
343
+ readonly result: ValidationResult;
344
+
345
+ constructor(result: ValidationResult);
346
+ }
347
+
348
+ export class ContainerValidator {
349
+ constructor(container: ContainerBuilder);
350
+
351
+ validate(): ValidationResult;
352
+ }
353
+
354
+ export class Condition {
355
+ readonly type: string;
356
+ readonly options: object;
357
+
358
+ constructor(type: string, options?: object);
359
+
360
+ isPhaseOne(): boolean;
361
+
362
+ isPhaseTwo(): boolean;
363
+
364
+ evaluate(): boolean;
365
+
366
+ evaluatePhaseTwo(remainingIds: Set<string>): boolean;
367
+
368
+ static envExists(varName: string): Condition;
369
+
370
+ static envEquals(varName: string, value: string): Condition;
371
+
372
+ static custom(fn: () => boolean): Condition;
373
+
374
+ static all(...conditions: Condition[]): Condition;
375
+
376
+ static any(...conditions: Condition[]): Condition;
377
+
378
+ static missing(id: string): Condition;
379
+
380
+ static serviceExists(id: string): Condition;
381
+ }
@@ -1,4 +1,5 @@
1
1
  import {
2
+ Autowire,
2
3
  Call,
3
4
  CompilerPass,
4
5
  ContainerBuilder,
@@ -9,7 +10,9 @@ import {
9
10
  PackageReference,
10
11
  PassConfig,
11
12
  Reference,
13
+ ServiceFile,
12
14
  Tag,
15
+ XmlFileLoader,
13
16
  YamlFileLoader
14
17
  } from './index'
15
18
 
@@ -53,7 +56,7 @@ class SomeManager {
53
56
  }
54
57
 
55
58
  class CustomPass implements CompilerPass {
56
- process(container: ContainerBuilder) {
59
+ async process(container: ContainerBuilder) {
57
60
  // ... do something during the compilation
58
61
  }
59
62
  }
@@ -70,6 +73,13 @@ function assertIsDefinition(value: Definition): void {
70
73
  }
71
74
  }
72
75
 
76
+ async function assertIsPromisedDefinition(value: Promise<Definition>): Promise<void> {
77
+ const definition = await value
78
+ if (!(definition instanceof Definition)) {
79
+ throw TypeError()
80
+ }
81
+ }
82
+
73
83
  function assertType<T>(value: T): void {
74
84
  }
75
85
 
@@ -115,13 +125,20 @@ container.logger = new NullLogger()
115
125
  // Other methods
116
126
  assertIsBoolean(container.has('some'))
117
127
  assertIsBoolean(container.hasDefinition('some'))
128
+ assertIsBoolean(container.hasAlias('some'))
118
129
  assertIsBoolean(container.removeDefinition('some'))
119
130
  assertIsDefinition(container.getDefinition('some'))
120
- assertIsDefinition(container.findDefinition('some'))
131
+ assertIsPromisedDefinition(container.findDefinition('some'))
121
132
  assertIsBoolean(container.hasParameter('mailer.transport'))
122
133
  container.findTaggedServiceIds('tag')
123
134
  container.setAlias('mailer', 'service.mailer')
124
135
  container.setParameter('mailer.transport', 'sendmail')
136
+ // defaultDir setter
137
+ container.defaultDir = '/'
138
+ // autowire getter/setter
139
+ const autowire = new Autowire(container)
140
+ container.autowire = autowire
141
+ assertType<Autowire | null>(container.autowire)
125
142
  // Compile
126
143
  container.addCompilerPass(new CustomPass())
127
144
  container.addCompilerPass(new CustomPass(), PassConfig.TYPE_AFTER_REMOVING)
@@ -141,10 +158,15 @@ container = new ContainerBuilder()
141
158
  loader = new JsFileLoader(container)
142
159
  loader.load('/path/to/file.js')
143
160
 
161
+ container = new ContainerBuilder()
162
+ loader = new XmlFileLoader(container)
163
+ loader.load('/path/to/file.xml')
164
+
144
165
  // * Definition *
145
166
  // Constructor
146
167
  new Definition()
147
168
  new Definition(null, ['some_argument'])
169
+ new Definition(Mailer, ['sendmail'], [new Reference('other')])
148
170
  const mailerDefinition = new Definition(Mailer, ['sendmail'])
149
171
 
150
172
  // Properties
@@ -160,6 +182,8 @@ mailerDefinition.parent = 'base_mailer'
160
182
  mailerDefinition.Object = {}
161
183
  mailerDefinition.args = [3.14, 'sendmail', new PackageReference('fs')]
162
184
  mailerDefinition.appendArgs = ['sendmail']
185
+ mailerDefinition.overrideArgs = [new Reference('mailer')]
186
+ assertType<any[]>(mailerDefinition.overrideArgs)
163
187
  // Readonly properties
164
188
  const mailerFactory = mailerDefinition.factory
165
189
  if (mailerFactory != null) {
@@ -175,6 +199,8 @@ mailerDefinition.addTag('tag_name')
175
199
  const tagAttributes = new Map()
176
200
  tagAttributes.set('event', 'prePersist')
177
201
  mailerDefinition.addTag('listener', tagAttributes)
202
+ mailerDefinition.addArgument('arg')
203
+ mailerDefinition.addArgument('arg', true)
178
204
  new Definition(SomeManager).setFactory(SomeManager, 'getFactory')
179
205
 
180
206
  // Setter injection
@@ -185,3 +211,11 @@ container.setDefinition('mailer_manage', mailerManagerDefinition)
185
211
  // Property injection
186
212
  const definition = new Definition(NewsletterManager)
187
213
  definition.addProperty('mailer', new Reference('mailer'))
214
+
215
+ // * ServiceFile *
216
+ new ServiceFile('/path/to/services.yaml')
217
+ new ServiceFile('/path/to/services.yaml', true)
218
+
219
+ // * Autowire *
220
+ const autowireWithTsConfig = new Autowire(container, '/path/to/tsconfig.json')
221
+ assertType<ContainerBuilder>(autowireWithTsConfig.container)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-dependency-injection",
3
- "version": "4.0.0-alpha.0",
3
+ "version": "4.1.0",
4
4
  "description": "The NodeDependencyInjection component allows you to standardize and centralize the way objects are constructed in your application.",
5
5
  "main": "dist/lib/index.js",
6
6
  "directories": {
@@ -11,17 +11,16 @@
11
11
  "ndi": "dist/bin/ndi.js"
12
12
  },
13
13
  "scripts": {
14
- "test": "cross-env NODE_ENV=test mocha -r ts-node/register",
15
- "test:coverage": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha",
14
+ "test": "cross-env NODE_ENV=test ts-mocha --paths",
15
+ "test:coverage": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text ts-mocha --paths",
16
16
  "test:standard": "standard",
17
17
  "test:standard:fix": "standard --fix",
18
- "build:lib": "rm -rf dist/lib/* && babel lib -d dist/lib -D",
19
- "build:bin": "rm -rf dist/bin/* && babel bin -d dist/bin -D",
18
+ "build:lib": "rm -rf dist/lib/* && babel lib -d dist/lib -D --compact --no-comments",
19
+ "build:bin": "rm -rf dist/bin/* && babel bin -d dist/bin -D --compact --no-comments",
20
20
  "build": "npm run build:lib && npm run build:bin",
21
21
  "report:coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
22
22
  "preversion": "npm run test:standard && npm test",
23
- "version": "npm run build",
24
- "postversion": "git push && git push --tags && npm publish"
23
+ "postversion": "git push && git push --tags"
25
24
  },
26
25
  "standard": {
27
26
  "ignore": [
@@ -49,32 +48,47 @@
49
48
  "url": "https://github.com/zazoomauro/node-dependency-injection/issues"
50
49
  },
51
50
  "homepage": "https://github.com/zazoomauro/node-dependency-injection#readme",
51
+ "engines": {
52
+ "node": ">=15.0.0"
53
+ },
52
54
  "dependencies": {
53
- "@babel/plugin-transform-runtime": "^7.17.10",
54
- "@typescript-eslint/parser": "^5.22.0",
55
+ "@babel/runtime": "^7.26.10",
56
+ "@typescript-eslint/typescript-estree": "^5.23.0",
55
57
  "chalk": "^4.1.0",
56
58
  "commander": "^8.3.0",
57
59
  "console.table": "^0.10.0",
58
- "js-yaml": "^4.0.0",
60
+ "fast-xml-parser": "^5.7.3",
61
+ "js-yaml": "^4.1.1",
62
+ "json5": "^2.2.2",
59
63
  "validate-npm-package-name": "^3.0.0"
60
64
  },
61
65
  "devDependencies": {
62
66
  "@babel/cli": "^7.17.10",
63
67
  "@babel/core": "^7.17.10",
68
+ "@babel/plugin-transform-runtime": "^7.25.4",
64
69
  "@babel/preset-env": "^7.17.10",
65
70
  "@babel/register": "^7.17.7",
66
71
  "@types/chai": "^4.3.1",
72
+ "@types/expect": "^24.3.0",
67
73
  "@types/mocha": "^9.1.1",
68
74
  "babel-plugin-istanbul": "^6.1.1",
69
75
  "chai": "^4.3.6",
76
+ "chai-as-promised": "^7.1.1",
77
+ "chai-iterator": "^3.0.2",
70
78
  "codecov": "^4.0.0-0",
71
79
  "cross-env": "^7.0.3",
80
+ "eslint": "^8.57.1",
81
+ "eslint-config-standard": "^17.0.0",
82
+ "eslint-plugin-n": "^15.2.0",
83
+ "eslint-plugin-sonarjs": "^0.13.0",
72
84
  "istanbul": "^0.4.5",
73
85
  "mocha": "^9.2.2",
74
86
  "nyc": "^15.1.0",
75
87
  "sinon": "^11.1.2",
76
88
  "standard": "^16.0.4",
89
+ "ts-mocha": "^10.0.0",
77
90
  "ts-node": "^10.7.0",
91
+ "tsconfig-paths": "^4.0.0",
78
92
  "typescript": "^4.6.4"
79
93
  },
80
94
  "babel": {
@@ -82,7 +96,7 @@
82
96
  "@babel/preset-env"
83
97
  ],
84
98
  "plugins": [
85
- "@babel/plugin-transform-runtime"
99
+ "@babel/transform-runtime"
86
100
  ],
87
101
  "env": {
88
102
  "test": {
package/tsconfig.json CHANGED
@@ -1,5 +1,12 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "lib": ["DOM", "ES7"]
3
+ "target": "ES6",
4
+ "lib": ["DOM", "ES7"],
5
+ "baseUrl": ".",
6
+ "paths": {
7
+ "@app/*": [
8
+ "./test/Resources-ts/AutowireModulePath/src/*",
9
+ ]
10
+ }
4
11
  }
5
12
  }
package/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - '16'
4
- - '15'
5
- - '14'
6
- - '13'
7
- - '12'
8
- - '11'
9
- - '10'
10
- script:
11
- - npm run test:standard
12
- - npm run test:coverage
13
- after_success:
14
- - npm run report:coverage