Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
fix(Components): if component doesn't have metadata we should provide…
Browse files Browse the repository at this point in the history
…d, explicit case related with removing dependency injection from @rxdi/lit-html so it can be used stand alone
  • Loading branch information
Stradivario committed Apr 23, 2020
1 parent c724608 commit c589400
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions dist/services/module/module.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const effect_service_1 = require("../effect/effect.service");
const components_service_1 = require("../components/components.service");
const bootstraps_service_1 = require("../bootstraps/bootstraps.service");
const services_service_1 = require("../services/services.service");
const reflect_decorator_1 = require("../../helpers/reflect.decorator");
let ModuleService = class ModuleService {
constructor() {
this.watcherService = constructor_watcher_1.constructorWatcherService;
Expand Down Expand Up @@ -110,6 +111,9 @@ let ModuleService = class ModuleService {
}
setComponents(components, original, currentModule) {
components.forEach(component => {
if (!component['metadata']) {
reflect_decorator_1.ReflectDecorator({}, { type: 'component' })(component);
}
this.validators.validateComponent(component, original);
currentModule.putItem({
data: component,
Expand All @@ -130,6 +134,9 @@ let ModuleService = class ModuleService {
}
setBootstraps(bootstraps, original, currentModule) {
bootstraps.forEach(bootstrap => {
if (!bootstrap['metadata']) {
reflect_decorator_1.ReflectDecorator({}, { type: 'component' })(bootstrap);
}
this.validators.validateEmpty(bootstrap, original, bootstrap['metadata']['type']);
currentModule.putItem({
data: bootstrap,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rxdi/core",
"version": "0.7.40",
"version": "0.7.41",
"description": "",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
7 changes: 7 additions & 0 deletions src/services/module/module.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ComponentsService } from '../components/components.service';
import { BootstrapsServices } from '../bootstraps/bootstraps.service';
import { ServicesService } from '../services/services.service';
import { CacheLayer, CacheLayerItem } from '../../services/cache/';
import { ReflectDecorator } from '../../helpers/reflect.decorator';

@Service()
export class ModuleService {
Expand Down Expand Up @@ -153,6 +154,9 @@ export class ModuleService {
currentModule: CacheLayer<CacheLayerItem<Function>>
) {
components.forEach(component => {
if (!component['metadata']) {
ReflectDecorator({}, { type: 'component' })(component);
}
this.validators.validateComponent(component, original);
currentModule.putItem({
data: component,
Expand Down Expand Up @@ -183,6 +187,9 @@ export class ModuleService {
currentModule: CacheLayer<CacheLayerItem<Function>>
) {
bootstraps.forEach(bootstrap => {
if (!bootstrap['metadata']) {
ReflectDecorator({}, { type: 'component' })(bootstrap);
}
this.validators.validateEmpty(
bootstrap,
original,
Expand Down

0 comments on commit c589400

Please sign in to comment.