@tsed/cli-core 3.20.9 → 3.20.12
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 +28 -26
- package/lib/index.js.map +1 -1
- package/lib/index.modern.js +29 -27
- package/lib/index.modern.js.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1614,41 +1614,43 @@ exports.CliHttpClient = CliHttpClient_1 = tslib.__decorate([di.Injectable()], ex
|
|
|
1614
1614
|
const all = promises => Promise.all(promises);
|
|
1615
1615
|
|
|
1616
1616
|
async function loadPlugins(injector) {
|
|
1617
|
-
const
|
|
1618
|
-
|
|
1619
|
-
project: {
|
|
1620
|
-
rootDir
|
|
1621
|
-
}
|
|
1622
|
-
} = injector.settings;
|
|
1617
|
+
const name = injector.settings.get("name");
|
|
1618
|
+
const rootDir = injector.settings.get("project.rootDir");
|
|
1623
1619
|
const projectPackageJson = injector.invoke(exports.ProjectPackageJson);
|
|
1624
1620
|
const fs = injector.invoke(exports.CliFs);
|
|
1625
1621
|
const promises = Object.keys(projectPackageJson.allDependencies).filter(mod => mod.startsWith(`@${name}/cli-plugin`) || mod.includes(`${name}-cli-plugin`)).map(async mod => {
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1622
|
+
try {
|
|
1623
|
+
const {
|
|
1624
|
+
default: plugin
|
|
1625
|
+
} = await fs.importModule(mod, rootDir);
|
|
1629
1626
|
|
|
1630
|
-
|
|
1631
|
-
|
|
1627
|
+
if (!injector.has(plugin)) {
|
|
1628
|
+
var _GlobalProviders$get;
|
|
1632
1629
|
|
|
1633
|
-
|
|
1630
|
+
const provider = (_GlobalProviders$get = di.GlobalProviders.get(plugin)) == null ? void 0 : _GlobalProviders$get.clone();
|
|
1634
1631
|
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1632
|
+
if (provider != null && provider.imports.length) {
|
|
1633
|
+
await all(provider.imports.map(async token => {
|
|
1634
|
+
var _GlobalProviders$get2;
|
|
1638
1635
|
|
|
1639
|
-
|
|
1636
|
+
injector.add(token, (_GlobalProviders$get2 = di.GlobalProviders.get(token)) == null ? void 0 : _GlobalProviders$get2.clone());
|
|
1640
1637
|
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1638
|
+
if (injector.settings.get("loaded")) {
|
|
1639
|
+
await injector.invoke(token);
|
|
1640
|
+
}
|
|
1641
|
+
}));
|
|
1642
|
+
}
|
|
1646
1643
|
|
|
1647
|
-
|
|
1644
|
+
injector.add(plugin, provider);
|
|
1648
1645
|
|
|
1649
|
-
|
|
1650
|
-
|
|
1646
|
+
if (injector.settings.get("loaded")) {
|
|
1647
|
+
await injector.invoke(plugin);
|
|
1648
|
+
}
|
|
1651
1649
|
}
|
|
1650
|
+
|
|
1651
|
+
injector.logger.info(chalk__default['default'].green(listr2.figures.tick), mod, "module loaded");
|
|
1652
|
+
} catch (er) {
|
|
1653
|
+
injector.logger.warn(chalk__default['default'].red(listr2.figures.cross), "Fail to load plugin", mod);
|
|
1652
1654
|
}
|
|
1653
1655
|
});
|
|
1654
1656
|
await all(promises);
|
|
@@ -3693,7 +3695,7 @@ exports.CliCore = CliCore_1 = class CliCore {
|
|
|
3693
3695
|
const cli = injector.get(CliCore_1);
|
|
3694
3696
|
|
|
3695
3697
|
try {
|
|
3696
|
-
await cli.cliService.parseArgs(injector.settings.argv);
|
|
3698
|
+
await cli.cliService.parseArgs(injector.settings.get("argv"));
|
|
3697
3699
|
} catch (er) {
|
|
3698
3700
|
throw new CliError({
|
|
3699
3701
|
origin: er,
|
|
@@ -3709,7 +3711,7 @@ exports.CliCore = CliCore_1 = class CliCore {
|
|
|
3709
3711
|
const container = di.createContainer();
|
|
3710
3712
|
await injector.load(container, module);
|
|
3711
3713
|
await injector.emit("$afterInit");
|
|
3712
|
-
injector.settings.loaded
|
|
3714
|
+
injector.settings.set("loaded", true);
|
|
3713
3715
|
}
|
|
3714
3716
|
|
|
3715
3717
|
static updateNotifier(pkg) {
|