@tsed/cli-core 3.20.10 → 3.20.11
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.js +24 -18
- package/lib/index.js.map +1 -1
- package/lib/index.modern.js +25 -19
- package/lib/index.modern.js.map +1 -1
- package/package.json +1 -1
package/lib/index.modern.js
CHANGED
|
@@ -8,7 +8,7 @@ import { GlobalProviders, Provider, Injectable, DIConfiguration, Inject, Configu
|
|
|
8
8
|
export { Configuration, Constant, Container, DITest, Inject, Injectable, InjectorService, LocalsContainer, Module, Opts, OverrideProvider, UseOpts, Value, registerProvider } from '@tsed/di';
|
|
9
9
|
import { __decorate, __metadata, __param } from 'tslib';
|
|
10
10
|
import { Command as Command$1, Argument } from 'commander';
|
|
11
|
-
import { Listr, Logger as Logger$1 } from 'listr2';
|
|
11
|
+
import { Listr, Logger as Logger$1, figures } from 'listr2';
|
|
12
12
|
import { join, dirname, relative, resolve } from 'path';
|
|
13
13
|
import { EMPTY, throwError, Observable } from 'rxjs';
|
|
14
14
|
import { merge, filter, catchError } from 'rxjs/operators';
|
|
@@ -1588,32 +1588,38 @@ async function loadPlugins(injector) {
|
|
|
1588
1588
|
const projectPackageJson = injector.invoke(ProjectPackageJson);
|
|
1589
1589
|
const fs = injector.invoke(CliFs);
|
|
1590
1590
|
const promises = Object.keys(projectPackageJson.allDependencies).filter(mod => mod.startsWith(`@${name}/cli-plugin`) || mod.includes(`${name}-cli-plugin`)).map(async mod => {
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1591
|
+
try {
|
|
1592
|
+
const {
|
|
1593
|
+
default: plugin
|
|
1594
|
+
} = await fs.importModule(mod, rootDir);
|
|
1594
1595
|
|
|
1595
|
-
|
|
1596
|
-
|
|
1596
|
+
if (!injector.has(plugin)) {
|
|
1597
|
+
var _GlobalProviders$get;
|
|
1597
1598
|
|
|
1598
|
-
|
|
1599
|
+
const provider = (_GlobalProviders$get = GlobalProviders.get(plugin)) == null ? void 0 : _GlobalProviders$get.clone();
|
|
1599
1600
|
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1601
|
+
if (provider != null && provider.imports.length) {
|
|
1602
|
+
await all(provider.imports.map(async token => {
|
|
1603
|
+
var _GlobalProviders$get2;
|
|
1603
1604
|
|
|
1604
|
-
|
|
1605
|
+
injector.add(token, (_GlobalProviders$get2 = GlobalProviders.get(token)) == null ? void 0 : _GlobalProviders$get2.clone());
|
|
1605
1606
|
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1607
|
+
if (injector.settings.loaded) {
|
|
1608
|
+
await injector.invoke(token);
|
|
1609
|
+
}
|
|
1610
|
+
}));
|
|
1611
|
+
}
|
|
1611
1612
|
|
|
1612
|
-
|
|
1613
|
+
injector.add(plugin, provider);
|
|
1613
1614
|
|
|
1614
|
-
|
|
1615
|
-
|
|
1615
|
+
if (injector.settings.loaded) {
|
|
1616
|
+
await injector.invoke(plugin);
|
|
1617
|
+
}
|
|
1616
1618
|
}
|
|
1619
|
+
|
|
1620
|
+
injector.logger.info(chalk.green(figures.tick), mod, "module loaded");
|
|
1621
|
+
} catch (er) {
|
|
1622
|
+
injector.logger.warn(chalk.red(figures.cross), "Fail to load plugin", mod);
|
|
1617
1623
|
}
|
|
1618
1624
|
});
|
|
1619
1625
|
await all(promises);
|