@tsed/di 6.84.1 → 6.86.2
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.
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -2
- package/lib/index.js.map +1 -1
- package/lib/index.modern.js +12 -3
- package/lib/index.modern.js.map +1 -1
- package/lib/utils/colors.d.ts +5 -0
- package/package.json +3 -3
package/lib/index.modern.js
CHANGED
|
@@ -1410,9 +1410,18 @@ function Controller(options) {
|
|
|
1410
1410
|
}, path && Path(path), Children(...children));
|
|
1411
1411
|
}
|
|
1412
1412
|
|
|
1413
|
+
// istanbul ignore next
|
|
1413
1414
|
const colorIfAllowed = colorFn => text => !process.env.NO_COLOR ? colorFn(text) : text;
|
|
1414
1415
|
|
|
1415
1416
|
const red = colorIfAllowed(text => `\x1B[31m${text}\x1B[39m`);
|
|
1417
|
+
const yellow = colorIfAllowed(text => `\x1B[33m${text}\x1B[39m`);
|
|
1418
|
+
const green = colorIfAllowed(text => `\x1B[32m${text}\x1B[39m`);
|
|
1419
|
+
const colors = {
|
|
1420
|
+
red,
|
|
1421
|
+
yellow,
|
|
1422
|
+
green
|
|
1423
|
+
};
|
|
1424
|
+
|
|
1416
1425
|
class InjectionError extends Error {
|
|
1417
1426
|
constructor(token, origin) {
|
|
1418
1427
|
super(isString(origin) ? origin : "");
|
|
@@ -1459,7 +1468,7 @@ function printDependencyInjectionError(token, options) {
|
|
|
1459
1468
|
const args = getConstructorArgNames(token).map((arg, index) => {
|
|
1460
1469
|
if (options.index === index) {
|
|
1461
1470
|
erroredArg = arg;
|
|
1462
|
-
arg = red(arg);
|
|
1471
|
+
arg = colors.red(arg);
|
|
1463
1472
|
}
|
|
1464
1473
|
|
|
1465
1474
|
return `${arg}: ${nameOf(options.deps[index])}`;
|
|
@@ -1467,7 +1476,7 @@ function printDependencyInjectionError(token, options) {
|
|
|
1467
1476
|
const signature = nameOf(token) + "->constructor(" + args + ")";
|
|
1468
1477
|
const indexOf = signature.indexOf(erroredArg) - 5;
|
|
1469
1478
|
|
|
1470
|
-
const drawline = indexOf => " ".repeat(indexOf) + red("^" + "‾".repeat(erroredArg.length - 1));
|
|
1479
|
+
const drawline = indexOf => " ".repeat(indexOf) + colors.red("^" + "‾".repeat(erroredArg.length - 1));
|
|
1471
1480
|
|
|
1472
1481
|
return "Unable to inject dependency. " + options.message + "\n\n" + signature + "\n" + (indexOf > -1 ? drawline(indexOf) : "");
|
|
1473
1482
|
}
|
|
@@ -2433,5 +2442,5 @@ function getConfiguration(module, configuration = {}) {
|
|
|
2433
2442
|
return config;
|
|
2434
2443
|
}
|
|
2435
2444
|
|
|
2436
|
-
export { Configuration, Constant, Container, ContextLogger, Controller, DIConfiguration, DIContext, DITest, DI_PARAMS, DI_PARAM_OPTIONS, GlobalProviderRegistry, GlobalProviders, INJECTABLE_PROP, Inject, Injectable, InjectablePropertyType, InjectionError, InjectorService, Intercept, Interceptor, LazyInject, LocalsContainer, Module, OptionalLazyInject, Opts, OverrideProvider, Provider, ProviderScope, ProviderType, Scope, Service, UndefinedTokenError, UseOpts, Value, createContainer, getConfiguration, injectProperty, registerController, registerFactory, registerProvider, registerValue, setLoggerLevel };
|
|
2445
|
+
export { Configuration, Constant, Container, ContextLogger, Controller, DIConfiguration, DIContext, DITest, DI_PARAMS, DI_PARAM_OPTIONS, GlobalProviderRegistry, GlobalProviders, INJECTABLE_PROP, Inject, Injectable, InjectablePropertyType, InjectionError, InjectorService, Intercept, Interceptor, LazyInject, LocalsContainer, Module, OptionalLazyInject, Opts, OverrideProvider, Provider, ProviderScope, ProviderType, Scope, Service, UndefinedTokenError, UseOpts, Value, colors, createContainer, getConfiguration, injectProperty, registerController, registerFactory, registerProvider, registerValue, setLoggerLevel };
|
|
2437
2446
|
//# sourceMappingURL=index.modern.js.map
|