yeoman-environment 3.18.3 → 3.18.4
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/environment.js +13 -9
- package/package.json +1 -1
package/lib/environment.js
CHANGED
|
@@ -850,15 +850,6 @@ class Environment extends Base {
|
|
|
850
850
|
create(namespaceOrPath, args, options) {
|
|
851
851
|
const namespace = this.toNamespace ? this.toNamespace(namespaceOrPath) : undefined;
|
|
852
852
|
|
|
853
|
-
let maybeGenerator;
|
|
854
|
-
if (namespace && this.getByNamespace) {
|
|
855
|
-
maybeGenerator = this.getByNamespace(namespace);
|
|
856
|
-
if (!maybeGenerator) {
|
|
857
|
-
this.lookupLocalNamespaces(namespace);
|
|
858
|
-
maybeGenerator = this.getByNamespace(namespace);
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
|
|
862
853
|
const checkGenerator = Generator => {
|
|
863
854
|
if (namespace && Generator && Generator.namespace && Generator.namespace !== namespace.namespace && Generator.namespace !== Environment.UNKNOWN_NAMESPACE) {
|
|
864
855
|
// Update namespace object in case of aliased namespace.
|
|
@@ -886,6 +877,19 @@ class Environment extends Base {
|
|
|
886
877
|
return Generator;
|
|
887
878
|
};
|
|
888
879
|
|
|
880
|
+
if (typeof namespaceOrPath !== 'string') {
|
|
881
|
+
return this.instantiate(checkGenerator(namespaceOrPath), args, options);
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
let maybeGenerator;
|
|
885
|
+
if (namespace && this.getByNamespace) {
|
|
886
|
+
maybeGenerator = this.getByNamespace(namespace);
|
|
887
|
+
if (!maybeGenerator) {
|
|
888
|
+
this.lookupLocalNamespaces(namespace);
|
|
889
|
+
maybeGenerator = this.getByNamespace(namespace);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
889
893
|
maybeGenerator = maybeGenerator || this.get(namespaceOrPath);
|
|
890
894
|
if (maybeGenerator && maybeGenerator.then) {
|
|
891
895
|
return Promise.resolve(maybeGenerator)
|