How to use the mjml-validator.registerDependencies function in mjml-validator

To help you get started, we’ve selected a few mjml-validator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mjmlio / mjml / packages / mjml-core / src / helpers / mjmlconfig.js View on Github external
packages.forEach(compPath => {
    let resolvedPath = compPath
    try {
      resolvedPath = resolveComponentPath(compPath, componentRootPath)
      if (resolvedPath) {
        const requiredComp = require(resolvedPath) // eslint-disable-line global-require, import/no-dynamic-require
        registerCustomComponent(requiredComp.default || requiredComp, registerCompFn)
        registerDependencies((requiredComp.default || requiredComp).dependencies)
        result.success.push(compPath)
      }
    } catch (e) {
      result.failures.push({ error: e, compPath })
      if (e.code === 'ENOENT' || e.code === 'MODULE_NOT_FOUND') {
        console.error('Missing or unreadable custom component : ', resolvedPath) // eslint-disable-line no-console
      } else {
        console.error('Error when registering custom component : ', resolvedPath, e) // eslint-disable-line no-console
      }
    }
  })

mjml-validator

mjml-validator

MIT
Latest version published 8 months ago

Package Health Score

91 / 100
Full package analysis

Similar packages