@kithinji/orca 1.0.2 → 1.0.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.
@@ -1810,6 +1810,7 @@ var kithinjiorca = (() => {
1810
1810
  const module = await import(path);
1811
1811
  const ComponentClass = module[name];
1812
1812
  const params = Reflect.getMetadata(DESIGN_PARAMTYPES, ComponentClass) || [];
1813
+ const deps = Reflect.getMetadata(COMPONENT_DEPS, ComponentClass) || [];
1813
1814
  const injector = getCurrentInjector();
1814
1815
  if (injector == null) {
1815
1816
  throw new Error(`Couldn't find an injector`);
@@ -1822,7 +1823,14 @@ var kithinjiorca = (() => {
1822
1823
  useClass: ComponentClass,
1823
1824
  scope: "transient"
1824
1825
  });
1825
- [...params].forEach((p) => injector.addProvider(p));
1826
+ deps.forEach(
1827
+ (depClass) => injector.addProvider({
1828
+ provide: depClass,
1829
+ useClass: depClass,
1830
+ scope: "transient"
1831
+ })
1832
+ );
1833
+ params.forEach((p) => injector.addProvider(p));
1826
1834
  const cleanProps = { ...props };
1827
1835
  delete cleanProps.__clientComponent;
1828
1836
  const componentInstance = injector.resolve(ComponentClass);
@@ -2013,7 +2021,7 @@ var kithinjiorca = (() => {
2013
2021
  }, 0);
2014
2022
  }
2015
2023
  function createComponent(ComponentClass, props = {}, parentComponent) {
2016
- let injector = parentComponent.__injector;
2024
+ let injector = getCurrentInjector();
2017
2025
  if (!injector) {
2018
2026
  throw new Error(`Cannot create component ${ComponentClass.name} outside injection context. No injector available from current context or parent component.`);
2019
2027
  }