From af19ddea6275b2cd21a0e4ea7611d7fd7080dac3 Mon Sep 17 00:00:00 2001 From: Nico Date: Mon, 29 Jan 2024 13:27:37 +0100 Subject: [PATCH] Automatic component dependencies registration (#2793) * Automatic component dependencies registration --- packages/mjml-core/src/components.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/mjml-core/src/components.js b/packages/mjml-core/src/components.js index 556d10927..a2a33f2b1 100644 --- a/packages/mjml-core/src/components.js +++ b/packages/mjml-core/src/components.js @@ -1,4 +1,5 @@ import { kebabCase } from 'lodash' +import { registerDependencies } from 'mjml-validator' const components = {} @@ -8,8 +9,12 @@ export function assignComponents(target, source) { } } -export function registerComponent(Component) { +export function registerComponent(Component, options = {}) { assignComponents(components, [Component]) + + if (Component.dependencies && options.registerDependencies) { + registerDependencies(Component.dependencies) + } } export default components